Class ShadowVariablesAssert
- java.lang.Object
-
- org.optaplanner.core.impl.domain.variable.listener.support.violation.ShadowVariablesAssert
-
public final class ShadowVariablesAssert extends Object
Serves for detecting shadow variables' corruption. When a snapshot is created, it records the state of all shadow variables of all entities. ThecreateShadowVariablesViolationMessage(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
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description String
createShadowVariablesViolationMessage(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 Detail
-
takeSnapshot
public static <Solution_> ShadowVariablesAssert takeSnapshot(SolutionDescriptor<Solution_> solutionDescriptor, Solution_ workingSolution)
-
createShadowVariablesViolationMessage
public String createShadowVariablesViolationMessage(long violationDisplayLimit)
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
-
-