Class ShadowVariablesAssert
java.lang.Object
org.optaplanner.core.impl.domain.variable.listener.support.violation.ShadowVariablesAssert
Serves for detecting shadow variables' corruption. When a snapshot is created, it records the state of all shadow variables
of all entities. The
createShadowVariablesViolationMessage(long)
method takes a look at the shadow variables again,
compares their state with the recorded one and describes the difference in a violation message.-
Method Summary
Modifier and TypeMethodDescriptioncreateShadowVariablesViolationMessage
(long violationDisplayLimit) Takes a look at the shadow variables of all entities and compares them against the recorded state.static <Solution_>
ShadowVariablesAsserttakeSnapshot
(SolutionDescriptor<Solution_> solutionDescriptor, Solution_ workingSolution)
-
Method Details
-
takeSnapshot
public static <Solution_> ShadowVariablesAssert takeSnapshot(SolutionDescriptor<Solution_> solutionDescriptor, Solution_ workingSolution) -
createShadowVariablesViolationMessage
Takes a look at the shadow variables of all entities and compares them against the recorded state. Every difference is added to the violation message. The first N differences up to theviolationDisplayLimit
are displayed in detail; the number of violations exceeding the display limit is reported at the end. The limit applies per each shadow variable descriptor.This method should be called after a forceful trigger of variable listeners.
- Parameters:
violationDisplayLimit
- maximum number of violations reported per shadow variable descriptor- Returns:
- description of the violations or
null
if there are none
-