org.drools.planner.core.score.director
Class AbstractScoreDirector<F extends ScoreDirectorFactory>

java.lang.Object
  extended by org.drools.planner.core.score.director.AbstractScoreDirector<F>
All Implemented Interfaces:
ScoreDirector
Direct Known Subclasses:
DroolsScoreDirector, IncrementalScoreDirector, SimpleScoreDirector

public abstract class AbstractScoreDirector<F extends ScoreDirectorFactory>
extends Object
implements ScoreDirector

Abstract superclass for ScoreDirector.

See Also:
ScoreDirector

Field Summary
protected  long calculateCount
           
protected  org.slf4j.Logger logger
           
protected  F scoreDirectorFactory
           
protected  Solution workingSolution
           
 
Constructor Summary
protected AbstractScoreDirector(F scoreDirectorFactory)
           
 
Method Summary
 void assertWorkingScore(Score workingScore)
           
protected  String buildScoreCorruptionAnalysis(ScoreDirector uncorruptedScoreDirector)
           
 long getCalculateCount()
           
 ScoreDefinition getScoreDefinition()
           
 SolutionDescriptor getSolutionDescriptor()
           
 Map<Object,List<Object>> getVariableToEntitiesMap(PlanningVariableDescriptor variableDescriptor)
           
 List<Object> getWorkingPlanningEntityList()
           
 Solution getWorkingSolution()
          The Solution that is used to calculate the Score.
 boolean isWorkingSolutionInitialized()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.drools.planner.core.score.director.ScoreDirector
afterAllVariablesChanged, afterEntityAdded, afterEntityRemoved, afterProblemFactAdded, afterProblemFactChanged, afterProblemFactRemoved, afterVariableChanged, beforeAllVariablesChanged, beforeEntityAdded, beforeEntityRemoved, beforeProblemFactAdded, beforeProblemFactChanged, beforeProblemFactRemoved, beforeVariableChanged, calculateScore, dispose, setWorkingSolution
 

Field Detail

logger

protected final transient org.slf4j.Logger logger

scoreDirectorFactory

protected final F extends ScoreDirectorFactory scoreDirectorFactory

workingSolution

protected Solution workingSolution

calculateCount

protected long calculateCount
Constructor Detail

AbstractScoreDirector

protected AbstractScoreDirector(F scoreDirectorFactory)
Method Detail

getSolutionDescriptor

public SolutionDescriptor getSolutionDescriptor()
Specified by:
getSolutionDescriptor in interface ScoreDirector
Returns:
never null

getScoreDefinition

public ScoreDefinition getScoreDefinition()
Specified by:
getScoreDefinition in interface ScoreDirector
Returns:
never null

getWorkingSolution

public Solution getWorkingSolution()
Description copied from interface: ScoreDirector
The Solution that is used to calculate the Score.

Because a Score is best calculated incrementally (by delta's), the ScoreDirector needs to be notified when it's workingSolution changes.

If the Solution has been changed since ScoreDirector.calculateScore() has been called, the Solution.getScore() of this Solution won't be correct.

Specified by:
getWorkingSolution in interface ScoreDirector
Returns:
never null

getCalculateCount

public long getCalculateCount()
Specified by:
getCalculateCount in interface ScoreDirector
Returns:
at least 0L

getWorkingPlanningEntityList

public List<Object> getWorkingPlanningEntityList()
Specified by:
getWorkingPlanningEntityList in interface ScoreDirector
Returns:
never null: an empty list if there are none

isWorkingSolutionInitialized

public boolean isWorkingSolutionInitialized()
Specified by:
isWorkingSolutionInitialized in interface ScoreDirector
Returns:
true if the workingSolution is initialized

getVariableToEntitiesMap

public Map<Object,List<Object>> getVariableToEntitiesMap(PlanningVariableDescriptor variableDescriptor)
Specified by:
getVariableToEntitiesMap in interface ScoreDirector
Parameters:
variableDescriptor - never null
Returns:
never null

assertWorkingScore

public void assertWorkingScore(Score workingScore)
Specified by:
assertWorkingScore in interface ScoreDirector
Parameters:
workingScore - never null

buildScoreCorruptionAnalysis

protected String buildScoreCorruptionAnalysis(ScoreDirector uncorruptedScoreDirector)


Copyright © 2001-2014 JBoss by Red Hat. All Rights Reserved.