public class TestGenDroolsScoreDirector<Solution_> extends DroolsScoreDirector<Solution_>
GLOBAL_SCORE_HOLDER_KEY, kieSession, workingScoreHolderallChangesWillBeUndoneBeforeStepEnds, calculationCount, constraintMatchEnabledPreference, logger, scoreDirectorFactory, variableListenerSupport, workingEntityListRevision, workingInitScore, workingSolution| Constructor and Description |
|---|
TestGenDroolsScoreDirector(DroolsScoreDirectorFactory<Solution_> scoreDirectorFactory,
boolean constraintMatchEnabledPreference) |
| Modifier and Type | Method and Description |
|---|---|
void |
afterEntityAdded(EntityDescriptor<Solution_> entityDescriptor,
Object entity) |
void |
afterEntityRemoved(EntityDescriptor<Solution_> entityDescriptor,
Object entity) |
void |
afterProblemFactAdded(Object problemFact) |
void |
afterProblemFactRemoved(Object problemFact) |
void |
afterVariableChanged(VariableDescriptor variableDescriptor,
Object entity) |
void |
assertWorkingScoreFromScratch(Score workingScore,
Object completedAction)
Asserts that if the
Score is calculated for the current working solution
in a fresh ScoreDirector (with no incremental calculation residue),
it is equal to the parameter workingScore. |
Score |
calculateScore()
Calculates the
Score and updates the working solution accordingly. |
org.kie.api.runtime.KieSession |
createKieSession() |
void |
dispose()
Needs to be called after use because some implementations needs to clean up their resources.
|
Collection<ConstraintMatchTotal> |
getConstraintMatchTotals()
Explains the
Score of ScoreDirector.calculateScore(). |
void |
setWorkingSolution(Solution_ workingSolution)
The
working solution must never be the same instance as the
best solution, it should be a (un)changed clone. |
afterProblemPropertyChanged, clone, getKieSession, getWorkingFacts, isConstraintMatchEnabledafterEntityAdded, afterEntityRemoved, afterVariableChanged, assertExpectedWorkingScore, assertShadowVariablesAreNotStale, beforeEntityAdded, beforeEntityAdded, beforeEntityRemoved, beforeEntityRemoved, beforeProblemFactAdded, beforeProblemFactRemoved, beforeProblemPropertyChanged, beforeVariableChanged, beforeVariableChanged, buildScoreCorruptionAnalysis, changeVariableFacade, cloneSolution, cloneWorkingSolution, createChildThreadScoreDirector, extractIndictmentMap, getCalculationCount, getScoreDefinition, getScoreDirectorFactory, getSolutionDescriptor, getSupplyManager, getWorkingEntityCount, getWorkingEntityList, getWorkingEntityListRevision, getWorkingSolution, getWorkingValueCount, isAllChangesWillBeUndoneBeforeStepEnds, isConstraintMatchEnabledPreference, isWorkingEntityListDirty, overwriteConstraintMatchEnabledPreference, resetCalculationCount, setAllChangesWillBeUndoneBeforeStepEnds, setCalculatedScore, setWorkingEntityListDirty, toString, triggerVariableListenerspublic TestGenDroolsScoreDirector(DroolsScoreDirectorFactory<Solution_> scoreDirectorFactory, boolean constraintMatchEnabledPreference)
public org.kie.api.runtime.KieSession createKieSession()
public void setWorkingSolution(Solution_ workingSolution)
ScoreDirectorworking solution must never be the same instance as the
best solution, it should be a (un)changed clone.
Only call this method on a separate ScoreDirector instance,
built by Solver.getScoreDirectorFactory(),
not on the one used inside the Solver itself.
setWorkingSolution in interface ScoreDirector<Solution_>setWorkingSolution in class DroolsScoreDirector<Solution_>workingSolution - never nullpublic Score calculateScore()
ScoreDirectorScore and updates the working solution accordingly.calculateScore in interface ScoreDirector<Solution_>calculateScore in class DroolsScoreDirector<Solution_>Score of the working solutionpublic void assertWorkingScoreFromScratch(Score workingScore, Object completedAction)
InnerScoreDirectorScore is calculated for the current working solution
in a fresh ScoreDirector (with no incremental calculation residue),
it is equal to the parameter workingScore.
Furthermore, if the assert fails, a score corruption analysis might be included in the exception message.
assertWorkingScoreFromScratch in interface InnerScoreDirector<Solution_>assertWorkingScoreFromScratch in class AbstractScoreDirector<Solution_,DroolsScoreDirectorFactory<Solution_>>workingScore - never nullcompletedAction - sometimes null, when assertion fails then the completedAction's Object.toString()
is included in the exception messageInnerScoreDirectorFactory#assertScoreFromScratch(Solution_)public Collection<ConstraintMatchTotal> getConstraintMatchTotals()
ScoreDirectorScore of ScoreDirector.calculateScore().getConstraintMatchTotals in interface ScoreDirector<Solution_>getConstraintMatchTotals in class DroolsScoreDirector<Solution_>public void dispose()
ScoreDirectordispose in interface ScoreDirector<Solution_>dispose in class DroolsScoreDirector<Solution_>public void afterEntityAdded(EntityDescriptor<Solution_> entityDescriptor, Object entity)
afterEntityAdded in class DroolsScoreDirector<Solution_>public void afterVariableChanged(VariableDescriptor variableDescriptor, Object entity)
afterVariableChanged in interface ScoreDirector<Solution_>afterVariableChanged in class DroolsScoreDirector<Solution_>public void afterEntityRemoved(EntityDescriptor<Solution_> entityDescriptor, Object entity)
afterEntityRemoved in class DroolsScoreDirector<Solution_>public void afterProblemFactAdded(Object problemFact)
afterProblemFactAdded in interface ScoreDirector<Solution_>afterProblemFactAdded in class DroolsScoreDirector<Solution_>public void afterProblemFactRemoved(Object problemFact)
afterProblemFactRemoved in interface ScoreDirector<Solution_>afterProblemFactRemoved in class DroolsScoreDirector<Solution_>Copyright © 2006–2016 JBoss by Red Hat. All rights reserved.