Class AbstractScoreHolder<Score_ extends Score<Score_>>
java.lang.Object
org.optaplanner.constraint.drl.holder.AbstractScoreHolder<Score_>
- Type Parameters:
- Score_- the- Scoretype
- All Implemented Interfaces:
- ScoreHolder<Score_>
- Direct Known Subclasses:
- BendableBigDecimalScoreHolderImpl,- BendableLongScoreHolderImpl,- BendableScoreHolderImpl,- HardMediumSoftBigDecimalScoreHolderImpl,- HardMediumSoftLongScoreHolderImpl,- HardMediumSoftScoreHolderImpl,- HardSoftBigDecimalScoreHolderImpl,- HardSoftLongScoreHolderImpl,- HardSoftScoreHolderImpl,- SimpleBigDecimalScoreHolderImpl,- SimpleLongScoreHolderImpl,- SimpleScoreHolderImpl
public abstract class AbstractScoreHolder<Score_ extends Score<Score_>>
extends Object
implements ScoreHolder<Score_>
Abstract superclass for 
ScoreHolder.
 Instances of this class are used only in DRL.- 
Nested Class SummaryNested ClassesModifier and TypeClassDescriptionprotected static interfaceclassprotected static interfaceprotected static interfaceprotected static interfaceUnlikeAbstractScoreHolder.IntMatchExecutorand its counterparts, this is not being used on CS-D code paths.
- 
Field SummaryFieldsModifier and TypeFieldDescriptionprotected final booleanprotected final Map<String,ConstraintMatchTotal<Score_>> protected final Map<Object,Indictment<Score_>> 
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionstatic <Score_ extends Score<Score_>,ScoreHolder_ extends AbstractScoreHolder<Score_>> 
 ScoreHolder_buildScoreHolder(ScoreDefinition<Score_> scoreDefinition, boolean constraintMatchEnabled) voidconfigureConstraintWeight(org.kie.api.definition.rule.Rule rule, Score_ constraintWeight) extractJustificationList(org.kie.api.runtime.rule.RuleContext kcontext) abstract Score_extractScore(int initScore) voidimpactScore(org.kie.api.runtime.rule.RuleContext kcontext) For internal use only, use penalize() or reward() instead.abstract voidimpactScore(org.kie.api.runtime.rule.RuleContext kcontext, int weightMultiplier) For internal use only, use penalize() or reward() instead.abstract voidimpactScore(org.kie.api.runtime.rule.RuleContext kcontext, long weightMultiplier) For internal use only, use penalize() or reward() instead.abstract voidimpactScore(org.kie.api.runtime.rule.RuleContext kcontext, BigDecimal weightMultiplier) For internal use only, use penalize() or reward() instead.booleanprotected voidregisterConstraintMatch(org.kie.api.runtime.rule.RuleContext kcontext, Runnable constraintUndoListener, Supplier<Score_> scoreSupplier) Requires a custom rule event listener to be added as event listener onKieSession, otherwise the score changes caused by the constraint matches would not be undone.Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.optaplanner.core.api.score.holder.ScoreHolderpenalize, reward
- 
Field Details- 
constraintMatchEnabledprotected final boolean constraintMatchEnabled
- 
constraintMatchTotalMap
- 
indictmentMap
 
- 
- 
Constructor Details- 
AbstractScoreHolderprotected AbstractScoreHolder(boolean constraintMatchEnabled) 
 
- 
- 
Method Details- 
buildScoreHolderpublic static <Score_ extends Score<Score_>,ScoreHolder_ extends AbstractScoreHolder<Score_>> ScoreHolder_ buildScoreHolder(ScoreDefinition<Score_> scoreDefinition, boolean constraintMatchEnabled) 
- 
isConstraintMatchEnabledpublic boolean isConstraintMatchEnabled()
- 
getConstraintMatchTotalMap
- 
getIndictmentMap
- 
configureConstraintWeightpublic void configureConstraintWeight(org.kie.api.definition.rule.Rule rule, Score_ constraintWeight) 
- 
registerConstraintMatchprotected void registerConstraintMatch(org.kie.api.runtime.rule.RuleContext kcontext, Runnable constraintUndoListener, Supplier<Score_> scoreSupplier) Requires a custom rule event listener to be added as event listener onKieSession, otherwise the score changes caused by the constraint matches would not be undone. SeeDrlScoreDirector.setWorkingSolution(Object)for an example.- Parameters:
- kcontext- The rule for which to register the match.
- constraintUndoListener- The operation to run to undo the match.
- scoreSupplier- The score change to be undone when constraint justification enabled.
 
- 
impactScorepublic void impactScore(org.kie.api.runtime.rule.RuleContext kcontext) For internal use only, use penalize() or reward() instead.- Parameters:
- kcontext- never null
 
- 
impactScorepublic abstract void impactScore(org.kie.api.runtime.rule.RuleContext kcontext, int weightMultiplier) For internal use only, use penalize() or reward() instead.- Parameters:
- kcontext- never null
- weightMultiplier- any
 
- 
impactScorepublic abstract void impactScore(org.kie.api.runtime.rule.RuleContext kcontext, long weightMultiplier) For internal use only, use penalize() or reward() instead.- Parameters:
- kcontext- never null
- weightMultiplier- any
 
- 
impactScorepublic abstract void impactScore(org.kie.api.runtime.rule.RuleContext kcontext, BigDecimal weightMultiplier) For internal use only, use penalize() or reward() instead.- Parameters:
- kcontext- never null
- weightMultiplier- any
 
- 
extractScore
- 
extractJustificationList
 
-