Record Class PhaseEventProducerId

java.lang.Object
java.lang.Record
ai.timefold.solver.core.impl.phase.event.PhaseEventProducerId
All Implemented Interfaces:
EventProducerId

@NullMarked public record PhaseEventProducerId(PhaseType phaseType, int index) extends Record implements EventProducerId
EventProducerId for when a BestSolutionChangedEvent is caused by a phase.
  • Constructor Summary

    Constructors
    Constructor
    Description
    PhaseEventProducerId(PhaseType phaseType, int index)
    Creates an instance of a PhaseEventProducerId record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    final boolean
    Indicates whether some other object is "equal to" this one.
    final int
    Returns a hash code value for this object.
    int
    Returns the value of the index record component.
    If present, the index of the phase that produced the event in the SolverConfig.getPhaseConfigList().
    Returns the value of the phaseType record component.
    An unique string identifying what produced the event, either of the form "Event" where "Event" is a string describing the event that cause the update (like "Solving started") or "Phase (index)", where "Phase" is a string identifying the type of phase (like "Construction Heuristics") and index is the index of the phase in the SolverConfig.getPhaseConfigList().
    A (non-unique) string describing what produced the event.
    Returns a string representation of this record class.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • PhaseEventProducerId

      public PhaseEventProducerId(PhaseType phaseType, int index)
      Creates an instance of a PhaseEventProducerId record class.
      Parameters:
      phaseType - the value for the phaseType record component
      index - the value for the index record component
  • Method Details

    • producerId

      public String producerId()
      Description copied from interface: EventProducerId
      An unique string identifying what produced the event, either of the form "Event" where "Event" is a string describing the event that cause the update (like "Solving started") or "Phase (index)", where "Phase" is a string identifying the type of phase (like "Construction Heuristics") and index is the index of the phase in the SolverConfig.getPhaseConfigList().
      Specified by:
      producerId in interface EventProducerId
      Returns:
      An unique string identifying what produced the event.
    • simpleProducerName

      public String simpleProducerName()
      Description copied from interface: EventProducerId
      A (non-unique) string describing what produced the event. Events from different phases of the same type (for example, when multiple Construction Heuristics are configured) will return the same value.
      Specified by:
      simpleProducerName in interface EventProducerId
      Returns:
      A (non-unique) string describing what produced the event.
    • phaseIndex

      public OptionalInt phaseIndex()
      Description copied from interface: EventProducerId
      If present, the index of the phase that produced the event in the SolverConfig.getPhaseConfigList(). Is absent when the producer does not correspond to a phase, for instance, an event triggered after ProblemChange were processed.
      Specified by:
      phaseIndex in interface EventProducerId
      Returns:
      The index of the corresponding phase in SolverConfig.getPhaseConfigList(), or OptionalInt.empty() if there is no corresponding phase.
    • toString

      public 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
    • equals

      public final boolean equals(Object o)
      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. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • phaseType

      public PhaseType phaseType()
      Returns the value of the phaseType record component.
      Returns:
      the value of the phaseType record component
    • index

      public int index()
      Returns the value of the index record component.
      Returns:
      the value of the index record component