Record Class VariableSnapshot<Solution_>
java.lang.Object
java.lang.Record
ai.timefold.solver.core.impl.domain.variable.listener.support.violation.VariableSnapshot<Solution_>
- Type Parameters:
Solution_-- Record Components:
variableId- The entity/variable pair that is recorded.value- The recorded value of the variable for the given entity.
public record VariableSnapshot<Solution_>(VariableId<Solution_> variableId, Object value)
extends Record
A
VariableSnapshot is a snapshot of the value of a variable for a given entity.
Only VariableSnapshot from the same solution instance can be compared.-
Constructor Summary
ConstructorsConstructorDescriptionVariableSnapshot(VariableDescriptor<Solution_> variableDescriptor, Object entity) VariableSnapshot(VariableId<Solution_> variableId, Object value) Creates an instance of aVariableSnapshotrecord class. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.getValue()final inthashCode()Returns a hash code value for this object.booleanisDifferentFrom(VariableSnapshot<Solution_> other) voidrestore()final StringtoString()Returns a string representation of this record class.value()Returns the value of thevaluerecord component.Returns the value of thevariableIdrecord component.
-
Constructor Details
-
VariableSnapshot
-
VariableSnapshot
Creates an instance of aVariableSnapshotrecord class.- Parameters:
variableId- the value for thevariableIdrecord componentvalue- the value for thevaluerecord component
-
-
Method Details
-
getVariableDescriptor
-
getEntity
-
getValue
-
getVariableId
-
restore
public void restore() -
isDifferentFrom
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
variableId
Returns the value of thevariableIdrecord component.- Returns:
- the value of the
variableIdrecord component
-
value
Returns the value of thevaluerecord component.- Returns:
- the value of the
valuerecord component
-