Class BendableLongScoreHolderImpl
- java.lang.Object
- 
- org.optaplanner.constraint.drl.holder.AbstractScoreHolder<BendableLongScore>
- 
- org.optaplanner.constraint.drl.holder.BendableLongScoreHolderImpl
 
 
- 
- All Implemented Interfaces:
- BendableLongScoreHolder,- ScoreHolder<BendableLongScore>
 
 public final class BendableLongScoreHolderImpl extends AbstractScoreHolder<BendableLongScore> implements BendableLongScoreHolder - See Also:
- BendableLongScore
 
- 
- 
Nested Class Summary- 
Nested classes/interfaces inherited from class org.optaplanner.constraint.drl.holder.AbstractScoreHolderAbstractScoreHolder.BigDecimalMatchExecutor, AbstractScoreHolder.ConstraintActivationUnMatchListener, AbstractScoreHolder.IntMatchExecutor, AbstractScoreHolder.LongMatchExecutor, AbstractScoreHolder.ScoreMatchExecutor<Score_ extends AbstractScore<Score_>>
 
- 
 - 
Field SummaryFields Modifier and Type Field Description protected Map<org.kie.api.definition.rule.Rule,AbstractScoreHolder.LongMatchExecutor>matchExecutorByNumberMapprotected Map<org.kie.api.definition.rule.Rule,AbstractScoreHolder.ScoreMatchExecutor<BendableLongScore>>matchExecutorByScoreMapSlower thanmatchExecutorByNumberMap- 
Fields inherited from class org.optaplanner.constraint.drl.holder.AbstractScoreHolderconstraintMatchEnabled, constraintMatchTotalMap, indictmentMap
 
- 
 - 
Constructor SummaryConstructors Constructor Description BendableLongScoreHolderImpl(boolean constraintMatchEnabled, int hardLevelsSize, int softLevelsSize)
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddHardConstraintMatch(org.kie.api.runtime.rule.RuleContext kcontext, int hardLevel, long weight)voidaddMultiConstraintMatch(org.kie.api.runtime.rule.RuleContext kcontext, long[] hardWeights, long[] softWeights)voidaddSoftConstraintMatch(org.kie.api.runtime.rule.RuleContext kcontext, int softLevel, long weight)voidconfigureConstraintWeight(org.kie.api.definition.rule.Rule rule, BendableLongScore constraintWeight)BendableLongScoreextractScore(int initScore)intgetHardLevelsSize()longgetHardScore(int hardLevel)intgetSoftLevelsSize()longgetSoftScore(int softLevel)voidimpactScore(org.kie.api.runtime.rule.RuleContext kcontext)For internal use only, use penalize() or reward() instead.voidimpactScore(org.kie.api.runtime.rule.RuleContext kcontext, int weightMultiplier)For internal use only, use penalize() or reward() instead.voidimpactScore(org.kie.api.runtime.rule.RuleContext kcontext, long weightMultiplier)For internal use only, use penalize() or reward() instead.voidimpactScore(org.kie.api.runtime.rule.RuleContext kcontext, BigDecimal weightMultiplier)For internal use only, use penalize() or reward() instead.voidpenalize(org.kie.api.runtime.rule.RuleContext kcontext)Penalize a match by theConstraintWeightnegated.voidpenalize(org.kie.api.runtime.rule.RuleContext kcontext, long weightMultiplier)Penalize a match by theConstraintWeightnegated and multiplied with the weightMultiplier for all score levels.voidpenalize(org.kie.api.runtime.rule.RuleContext kcontext, long[] hardWeightsMultiplier, long[] softWeightsMultiplier)Penalize a match by theConstraintWeightnegated and multiplied with the specific weightMultiplier per score level.voidreward(org.kie.api.runtime.rule.RuleContext kcontext)Reward a match by theConstraintWeight.voidreward(org.kie.api.runtime.rule.RuleContext kcontext, long weightMultiplier)Reward a match by theConstraintWeightmultiplied with the weightMultiplier for all score levels.voidreward(org.kie.api.runtime.rule.RuleContext kcontext, long[] hardWeightsMultiplier, long[] softWeightsMultiplier)Reward a match by theConstraintWeightmultiplied with the specific weightMultiplier per score level.- 
Methods inherited from class org.optaplanner.constraint.drl.holder.AbstractScoreHolderbuildScoreHolder, extractJustificationList, getConstraintMatchTotalMap, getIndictmentMap, isConstraintMatchEnabled, registerConstraintMatch
 
- 
 
- 
- 
- 
Field Detail- 
matchExecutorByNumberMapprotected final Map<org.kie.api.definition.rule.Rule,AbstractScoreHolder.LongMatchExecutor> matchExecutorByNumberMap 
 - 
matchExecutorByScoreMapprotected final Map<org.kie.api.definition.rule.Rule,AbstractScoreHolder.ScoreMatchExecutor<BendableLongScore>> matchExecutorByScoreMap Slower thanmatchExecutorByNumberMap
 
- 
 - 
Method Detail- 
getHardLevelsSizepublic int getHardLevelsSize() - Specified by:
- getHardLevelsSizein interface- BendableLongScoreHolder
 
 - 
getHardScorepublic long getHardScore(int hardLevel) 
 - 
getSoftLevelsSizepublic int getSoftLevelsSize() - Specified by:
- getSoftLevelsSizein interface- BendableLongScoreHolder
 
 - 
getSoftScorepublic long getSoftScore(int softLevel) 
 - 
configureConstraintWeightpublic void configureConstraintWeight(org.kie.api.definition.rule.Rule rule, BendableLongScore constraintWeight)- Overrides:
- configureConstraintWeightin class- AbstractScoreHolder<BendableLongScore>
 
 - 
penalizepublic void penalize(org.kie.api.runtime.rule.RuleContext kcontext) Description copied from interface:ScoreHolderPenalize a match by theConstraintWeightnegated.- Specified by:
- penalizein interface- ScoreHolder<BendableLongScore>
- Parameters:
- kcontext- never null, the magic variable in DRL
 
 - 
penalizepublic void penalize(org.kie.api.runtime.rule.RuleContext kcontext, long weightMultiplier)Description copied from interface:BendableLongScoreHolderPenalize a match by theConstraintWeightnegated and multiplied with the weightMultiplier for all score levels.- Specified by:
- penalizein interface- BendableLongScoreHolder
- Parameters:
- kcontext- never null, the magic variable in DRL
- weightMultiplier- at least 0
 
 - 
penalizepublic void penalize(org.kie.api.runtime.rule.RuleContext kcontext, long[] hardWeightsMultiplier, long[] softWeightsMultiplier)Description copied from interface:BendableLongScoreHolderPenalize a match by theConstraintWeightnegated and multiplied with the specific weightMultiplier per score level. Slower thanBendableLongScoreHolder.penalize(RuleContext, long).- Specified by:
- penalizein interface- BendableLongScoreHolder
- Parameters:
- kcontext- never null, the magic variable in DRL
- hardWeightsMultiplier- elements at least 0
- softWeightsMultiplier- elements at least 0
 
 - 
rewardpublic void reward(org.kie.api.runtime.rule.RuleContext kcontext) Description copied from interface:ScoreHolderReward a match by theConstraintWeight.- Specified by:
- rewardin interface- ScoreHolder<BendableLongScore>
- Parameters:
- kcontext- never null, the magic variable in DRL
 
 - 
rewardpublic void reward(org.kie.api.runtime.rule.RuleContext kcontext, long weightMultiplier)Description copied from interface:BendableLongScoreHolderReward a match by theConstraintWeightmultiplied with the weightMultiplier for all score levels.- Specified by:
- rewardin interface- BendableLongScoreHolder
- Parameters:
- kcontext- never null, the magic variable in DRL
- weightMultiplier- at least 0
 
 - 
rewardpublic void reward(org.kie.api.runtime.rule.RuleContext kcontext, long[] hardWeightsMultiplier, long[] softWeightsMultiplier)Description copied from interface:BendableLongScoreHolderReward a match by theConstraintWeightmultiplied with the specific weightMultiplier per score level. Slower thanBendableLongScoreHolder.reward(RuleContext, long).- Specified by:
- rewardin interface- BendableLongScoreHolder
- Parameters:
- kcontext- never null, the magic variable in DRL
- hardWeightsMultiplier- elements at least 0
- softWeightsMultiplier- elements at least 0
 
 - 
impactScorepublic void impactScore(org.kie.api.runtime.rule.RuleContext kcontext) Description copied from class:AbstractScoreHolderFor internal use only, use penalize() or reward() instead.- Overrides:
- impactScorein class- AbstractScoreHolder<BendableLongScore>
- Parameters:
- kcontext- never null
 
 - 
impactScorepublic void impactScore(org.kie.api.runtime.rule.RuleContext kcontext, int weightMultiplier)Description copied from class:AbstractScoreHolderFor internal use only, use penalize() or reward() instead.- Specified by:
- impactScorein class- AbstractScoreHolder<BendableLongScore>
- Parameters:
- kcontext- never null
- weightMultiplier- any
 
 - 
impactScorepublic void impactScore(org.kie.api.runtime.rule.RuleContext kcontext, long weightMultiplier)Description copied from class:AbstractScoreHolderFor internal use only, use penalize() or reward() instead.- Specified by:
- impactScorein interface- BendableLongScoreHolder
- Specified by:
- impactScorein class- AbstractScoreHolder<BendableLongScore>
- Parameters:
- kcontext- never null
- weightMultiplier- any
 
 - 
impactScorepublic void impactScore(org.kie.api.runtime.rule.RuleContext kcontext, BigDecimal weightMultiplier)Description copied from class:AbstractScoreHolderFor internal use only, use penalize() or reward() instead.- Specified by:
- impactScorein class- AbstractScoreHolder<BendableLongScore>
- Parameters:
- kcontext- never null
- weightMultiplier- any
 
 - 
addHardConstraintMatchpublic void addHardConstraintMatch(org.kie.api.runtime.rule.RuleContext kcontext, int hardLevel, long weight)- Specified by:
- addHardConstraintMatchin interface- BendableLongScoreHolder
- Parameters:
- kcontext- never null, the magic variable in DRL
- hardLevel-- 0 <= hardLevel <- BendableLongScoreHolder.getHardLevelsSize(). The- scoreLevelis- hardLevelfor hard levels and- softLevel + hardLevelSizefor soft levels.
- weight- higher is better, negative for a penalty, positive for a reward
 
 - 
addSoftConstraintMatchpublic void addSoftConstraintMatch(org.kie.api.runtime.rule.RuleContext kcontext, int softLevel, long weight)- Specified by:
- addSoftConstraintMatchin interface- BendableLongScoreHolder
- Parameters:
- kcontext- never null, the magic variable in DRL
- softLevel-- 0 <= softLevel <- BendableLongScoreHolder.getSoftLevelsSize(). The- scoreLevelis- hardLevelfor hard levels and- softLevel + hardLevelSizefor soft levels.
- weight- higher is better, negative for a penalty, positive for a reward
 
 - 
addMultiConstraintMatchpublic void addMultiConstraintMatch(org.kie.api.runtime.rule.RuleContext kcontext, long[] hardWeights, long[] softWeights)- Specified by:
- addMultiConstraintMatchin interface- BendableLongScoreHolder
- Parameters:
- kcontext- never null, the magic variable in DRL
- hardWeights- never null, array of length- BendableLongScoreHolder.getHardLevelsSize()
- softWeights- never null, array of length- BendableLongScoreHolder.getSoftLevelsSize()
 
 - 
extractScorepublic BendableLongScore extractScore(int initScore) - Specified by:
- extractScorein class- AbstractScoreHolder<BendableLongScore>
 
 
- 
 
-