Class SimpleLongScoreHolder

    • Field Detail

      • matchExecutorByNumberMap

        protected final Map<org.kie.api.definition.rule.Rule,​BiConsumer<org.kie.api.runtime.rule.RuleContext,​Long>> matchExecutorByNumberMap
      • score

        protected long score
    • Constructor Detail

      • SimpleLongScoreHolder

        public SimpleLongScoreHolder​(boolean constraintMatchEnabled)
    • Method Detail

      • getScore

        public long getScore()
      • penalize

        public void penalize​(org.kie.api.runtime.rule.RuleContext kcontext)
        Penalize a match by the ConstraintWeight negated.
        Parameters:
        kcontext - never null, the magic variable in DRL
      • penalize

        public void penalize​(org.kie.api.runtime.rule.RuleContext kcontext,
                             long weightMultiplier)
        Penalize a match by the ConstraintWeight negated and multiplied with the weightMultiplier for all score levels.
        Parameters:
        kcontext - never null, the magic variable in DRL
        weightMultiplier - at least 0
      • reward

        public void reward​(org.kie.api.runtime.rule.RuleContext kcontext)
        Reward a match by the ConstraintWeight.
        Parameters:
        kcontext - never null, the magic variable in DRL
      • reward

        public void reward​(org.kie.api.runtime.rule.RuleContext kcontext,
                           long weightMultiplier)
        Reward a match by the ConstraintWeight multiplied with the weightMultiplier for all score levels.
        Parameters:
        kcontext - never null, the magic variable in DRL
        weightMultiplier - at least 0
      • impactScore

        public void impactScore​(org.kie.api.runtime.rule.RuleContext kcontext,
                                long weightMultiplier)
        Description copied from class: AbstractScoreHolder
        For internal use only, use penalize() or reward() instead.
        Overrides:
        impactScore in class AbstractScoreHolder<SimpleLongScore>
        Parameters:
        kcontext - never null
        weightMultiplier - any
      • addConstraintMatch

        public void addConstraintMatch​(org.kie.api.runtime.rule.RuleContext kcontext,
                                       long weight)
        Parameters:
        kcontext - never null, the magic variable in DRL
        weight - higher is better, negative for a penalty, positive for a reward