java.lang.Object
java.lang.Record
ai.timefold.solver.core.impl.domain.variable.listener.support.violation.VariableId<Solution_>
Record Components:
variableDescriptor - The variable this VariableId refers to.
entity - The entity this VariableId refers to.

public record VariableId<Solution_>(VariableDescriptor<Solution_> variableDescriptor, Object entity) extends Record
A VariableId is an entity/variable of a given solution. VariableId cannot be compared across different solution instances, since variableDescriptor and entity are compared by reference equality.
  • Constructor Details

    • VariableId

      public VariableId(VariableDescriptor<Solution_> variableDescriptor, Object entity)
      Creates an instance of a VariableId record class.
      Parameters:
      variableDescriptor - the value for the variableDescriptor record component
      entity - the value for the entity record component
  • Method Details

    • equals

      public boolean equals(Object other)
      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 with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      other - the object with which to compare
      Returns:
      true if this object is the same as the other argument; false otherwise.
    • toString

      public final String 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.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • 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.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • variableDescriptor

      public VariableDescriptor<Solution_> variableDescriptor()
      Returns the value of the variableDescriptor record component.
      Returns:
      the value of the variableDescriptor record component
    • entity

      public Object entity()
      Returns the value of the entity record component.
      Returns:
      the value of the entity record component