Record Class LegacyCustomShadowVariableBasicVariableListener<Solution_>
java.lang.Object
java.lang.Record
ai.timefold.solver.core.impl.domain.variable.custom.LegacyCustomShadowVariableBasicVariableListener<Solution_>
- All Implemented Interfaces:
InnerBasicVariableListener<Solution_,,Object> InnerVariableListener<Solution_,,BasicVariableChangeEvent<Object>> Closeable,AutoCloseable
@NullMarked
public record LegacyCustomShadowVariableBasicVariableListener<Solution_>(Class<?>[] sourceEntityClasses, VariableListener<Solution_,Object> customVariableListener)
extends Record
implements InnerBasicVariableListener<Solution_,Object>
-
Constructor Summary
ConstructorsConstructorDescriptionLegacyCustomShadowVariableBasicVariableListener(Class<?>[] sourceEntityClasses, VariableListener<Solution_, Object> customVariableListener) Creates an instance of aLegacyCustomShadowVariableBasicVariableListenerrecord class. -
Method Summary
Modifier and TypeMethodDescriptionvoidafterChange(InnerScoreDirector<Solution_, ?> scoreDirector, BasicVariableChangeEvent<Object> event) voidbeforeChange(InnerScoreDirector<Solution_, ?> scoreDirector, BasicVariableChangeEvent<Object> event) voidclose()Called before thisInnerVariableListeneris thrown away and not used anymore.Returns the value of thecustomVariableListenerrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.booleanWhen set totrue, this has a performance loss.voidresetWorkingSolution(InnerScoreDirector<Solution_, ?> scoreDirector) Called when the entire working solution changes.Class<?>[]Returns the value of thesourceEntityClassesrecord component.toString()Returns a string representation of this record class.
-
Constructor Details
-
LegacyCustomShadowVariableBasicVariableListener
public LegacyCustomShadowVariableBasicVariableListener(Class<?>[] sourceEntityClasses, VariableListener<Solution_, Object> customVariableListener) Creates an instance of aLegacyCustomShadowVariableBasicVariableListenerrecord class.- Parameters:
sourceEntityClasses- the value for thesourceEntityClassesrecord componentcustomVariableListener- the value for thecustomVariableListenerrecord component
-
-
Method Details
-
beforeChange
public void beforeChange(InnerScoreDirector<Solution_, ?> scoreDirector, BasicVariableChangeEvent<Object> event) - Specified by:
beforeChangein interfaceInnerVariableListener<Solution_,BasicVariableChangeEvent<Object>>
-
afterChange
public void afterChange(InnerScoreDirector<Solution_, ?> scoreDirector, BasicVariableChangeEvent<Object> event) - Specified by:
afterChangein interfaceInnerVariableListener<Solution_,BasicVariableChangeEvent<Object>>
-
requiresUniqueEntityEvents
public boolean requiresUniqueEntityEvents()Description copied from interface:InnerVariableListenerWhen set totrue, this has a performance loss. When set tofalse, it's easier to make the listener implementation correct and fast.- Specified by:
requiresUniqueEntityEventsin interfaceInnerVariableListener<Solution_,BasicVariableChangeEvent<Object>> - Returns:
- true to guarantee that each of the before/after methods is only called once per entity instance per operation type (add, change or remove).
-
resetWorkingSolution
Description copied from interface:InnerVariableListenerCalled when the entire working solution changes. In this event, the other before..()/after...() methods will not be called. At this point, implementations should clear state, if any.- Specified by:
resetWorkingSolutionin interfaceInnerVariableListener<Solution_,BasicVariableChangeEvent<Object>>
-
close
public void close()Description copied from interface:InnerVariableListenerCalled before thisInnerVariableListeneris thrown away and not used anymore.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein interfaceInnerVariableListener<Solution_,BasicVariableChangeEvent<Object>>
-
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). -
sourceEntityClasses
Returns the value of thesourceEntityClassesrecord component.- Returns:
- the value of the
sourceEntityClassesrecord component
-
customVariableListener
Returns the value of thecustomVariableListenerrecord component.- Returns:
- the value of the
customVariableListenerrecord component
-