org.optaplanner.core.impl.score.director.drools

## Class DroolsScoreDirectorFactory<Solution_>

- java.lang.Object
- - org.optaplanner.core.impl.score.director.AbstractScoreDirectorFactory<Solution_>
  - - org.optaplanner.core.impl.score.director.drools.DroolsScoreDirectorFactory<Solution_>

- Type Parameters:
    `Solution_` - the solution type, the class with the `PlanningSolution` annotation
  All Implemented Interfaces:
    InnerScoreDirectorFactory<Solution_>, ScoreDirectorFactory<Solution_>
  Direct Known Subclasses:
    LegacyDroolsScoreDirectorFactory, TestGenDroolsScoreDirectorFactory

      public class DroolsScoreDirectorFactory<Solution_>
      extends AbstractScoreDirectorFactory<Solution_>

  Drools implementation of `ScoreDirectorFactory`.
  See Also:
    `DroolsScoreDirector`, `ScoreDirectorFactory`

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected org.kie.api.runtime.KieContainer` | `kieContainer`
    `protected String` | `ksessionName`
    `protected Map<org.kie.api.definition.rule.Rule,Function<Solution_,Score<?>>>` | `ruleToConstraintWeightExtractorMap`

    - ### Fields inherited from class org.optaplanner.core.impl.score.director.AbstractScoreDirectorFactory

      `assertClonedSolution, assertionScoreDirectorFactory, initializingScoreTrend, logger, solutionDescriptor`

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `DroolsScoreDirectorFactory(SolutionDescriptor<Solution_> solutionDescriptor, org.kie.api.KieBase kieBase)`
    `` | `DroolsScoreDirectorFactory(SolutionDescriptor<Solution_> solutionDescriptor, org.kie.api.runtime.KieContainer kieContainer, String ksessionName)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `DroolsScoreDirector<Solution_>` | `buildScoreDirector(boolean lookUpEnabled, boolean constraintMatchEnabledPreference)` Like `InnerScoreDirectorFactory.buildScoreDirector()`, but optionally disables `ConstraintMatch` tracking and look up for more performance (presuming the `ScoreDirector` implementation actually supports it to begin with).
    `protected void` | `checkIfGlobalScoreHolderExists(org.kie.api.KieBase kieBase)`
    `protected void` | `createRuleToConstraintWeightExtractorMap(org.kie.api.KieBase kieBase)`
    `org.kie.api.runtime.KieContainer` | `getKieContainer()`
    `String` | `getKsessionName()`
    `Map<org.kie.api.definition.rule.Rule,Function<Solution_,Score<?>>>` | `getRuleToConstraintWeightExtractorMap()`
    `org.kie.api.runtime.KieSession` | `newKieSession()`

    - ### Methods inherited from class org.optaplanner.core.impl.score.director.AbstractScoreDirectorFactory

      `assertScoreFromScratch, buildScoreDirector, getAssertionScoreDirectorFactory, getInitializingScoreTrend, getScoreDefinition, getSolutionDescriptor, isAssertClonedSolution, setAssertClonedSolution, setAssertionScoreDirectorFactory, setInitializingScoreTrend`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### kieContainer

          protected final org.kie.api.runtime.KieContainer kieContainer

    - #### ksessionName

          protected final String ksessionName

    - #### ruleToConstraintWeightExtractorMap

          protected Map<org.kie.api.definition.rule.Rule,Function<Solution_,Score<?>>> ruleToConstraintWeightExtractorMap

  - ### Constructor Detail

    - #### DroolsScoreDirectorFactory

          protected DroolsScoreDirectorFactory(SolutionDescriptor<Solution_> solutionDescriptor,
                                               org.kie.api.KieBase kieBase)

      Parameters:
        `solutionDescriptor` - never null For `LegacyDroolsScoreDirectorFactory` only. Do not use.
        `kieBase` - never null

    - #### DroolsScoreDirectorFactory

          public DroolsScoreDirectorFactory(SolutionDescriptor<Solution_> solutionDescriptor,
                                            org.kie.api.runtime.KieContainer kieContainer,
                                            String ksessionName)

      Parameters:
        `solutionDescriptor` - never null
        `kieContainer` - never null
        `ksessionName` - null if the default ksession should be used

  - ### Method Detail

    - #### checkIfGlobalScoreHolderExists

          protected void checkIfGlobalScoreHolderExists(org.kie.api.KieBase kieBase)

    - #### createRuleToConstraintWeightExtractorMap

          protected void createRuleToConstraintWeightExtractorMap(org.kie.api.KieBase kieBase)

    - #### getKieContainer

          public org.kie.api.runtime.KieContainer getKieContainer()

    - #### getKsessionName

          public String getKsessionName()

      Returns:
        null if the default ksession should be used

    - #### getRuleToConstraintWeightExtractorMap

          public Map<org.kie.api.definition.rule.Rule,Function<Solution_,Score<?>>> getRuleToConstraintWeightExtractorMap()

    - #### buildScoreDirector

          public DroolsScoreDirector<Solution_> buildScoreDirector(boolean lookUpEnabled,
                                                                   boolean constraintMatchEnabledPreference)

      Description copied from interface: `InnerScoreDirectorFactory`
      Like `InnerScoreDirectorFactory.buildScoreDirector()`, but optionally disables `ConstraintMatch` tracking and look up for more performance (presuming the `ScoreDirector` implementation actually supports it to begin with).
      Parameters:
        `lookUpEnabled` - true if a `ScoreDirector` implementation should track all working objects for `ScoreDirector.lookUpWorkingObject(Object)`
        `constraintMatchEnabledPreference` - false if a `ScoreDirector` implementation should not do `ConstraintMatch` tracking even if it supports it.
      Returns:
        never null
      See Also:
        `ScoreDirector.isConstraintMatchEnabled()`, `ScoreDirector.getConstraintMatchTotalMap()`

    - #### newKieSession

          public org.kie.api.runtime.KieSession newKieSession()

Copyright © 2006–2020 JBoss by Red Hat. All rights reserved.