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
ConstructorsConstructorDescriptionPhaseEventProducerId(PhaseType phaseType, int index) Creates an instance of aPhaseEventProducerIdrecord class. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.intindex()Returns the value of theindexrecord component.If present, the index of the phase that produced the event in theSolverConfig.getPhaseConfigList().Returns the value of thephaseTyperecord 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 theSolverConfig.getPhaseConfigList().A (non-unique) string describing what produced the event.toString()Returns a string representation of this record class.
-
Constructor Details
-
PhaseEventProducerId
Creates an instance of aPhaseEventProducerIdrecord class.- Parameters:
phaseType- the value for thephaseTyperecord componentindex- the value for theindexrecord component
-
-
Method Details
-
producerId
Description copied from interface:EventProducerIdAn 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 theSolverConfig.getPhaseConfigList().- Specified by:
producerIdin interfaceEventProducerId- Returns:
- An unique string identifying what produced the event.
-
simpleProducerName
Description copied from interface:EventProducerIdA (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:
simpleProducerNamein interfaceEventProducerId- Returns:
- A (non-unique) string describing what produced the event.
-
phaseIndex
Description copied from interface:EventProducerIdIf present, the index of the phase that produced the event in theSolverConfig.getPhaseConfigList(). Is absent when the producer does not correspond to a phase, for instance, an event triggered afterProblemChangewere processed.- Specified by:
phaseIndexin interfaceEventProducerId- Returns:
- The index of the corresponding phase in
SolverConfig.getPhaseConfigList(), orOptionalInt.empty()if there is no corresponding phase.
-
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. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
phaseType
Returns the value of thephaseTyperecord component.- Returns:
- the value of the
phaseTyperecord component
-
index
public int index()Returns the value of theindexrecord component.- Returns:
- the value of the
indexrecord component
-