Class AbstractScoreHolder<Score_ extends Score<Score_>>

    • Constructor Detail

      • AbstractScoreHolder

        protected AbstractScoreHolder​(boolean constraintMatchEnabled)
    • Method Detail

      • buildScoreHolder

        public static <Score_ extends Score<Score_>,​ScoreHolder_ extends AbstractScoreHolder<Score_>> ScoreHolder_ buildScoreHolder​(ScoreDefinition<Score_> scoreDefinition,
                                                                                                                                          boolean constraintMatchEnabled)
      • isConstraintMatchEnabled

        public boolean isConstraintMatchEnabled()
      • configureConstraintWeight

        public void configureConstraintWeight​(org.kie.api.definition.rule.Rule rule,
                                              Score_ constraintWeight)
      • registerConstraintMatch

        protected 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 on KieSession, otherwise the score changes caused by the constraint matches would not be undone. See DrlScoreDirector.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.
      • impactScore

        public void impactScore​(org.kie.api.runtime.rule.RuleContext kcontext)
        For internal use only, use penalize() or reward() instead.
        Parameters:
        kcontext - never null
      • impactScore

        public 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
      • impactScore

        public 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
      • impactScore

        public 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

        public abstract Score_ extractScore​(int initScore)
      • extractJustificationList

        protected List<Object> extractJustificationList​(org.kie.api.runtime.rule.RuleContext kcontext)