Class DroolsAbstractConstraintStream<Solution_,LHS_ extends org.optaplanner.constraint.streams.drools.common.AbstractLeftHandSide>

java.lang.Object
org.optaplanner.constraint.streams.common.AbstractConstraintStream<Solution_>
org.optaplanner.constraint.streams.drools.common.DroolsAbstractConstraintStream<Solution_,LHS_>
All Implemented Interfaces:
org.optaplanner.core.api.score.stream.ConstraintStream
Direct Known Subclasses:
DroolsAbstractBiConstraintStream, DroolsAbstractQuadConstraintStream, DroolsAbstractTriConstraintStream, DroolsAbstractUniConstraintStream

public abstract class DroolsAbstractConstraintStream<Solution_,LHS_ extends org.optaplanner.constraint.streams.drools.common.AbstractLeftHandSide> extends org.optaplanner.constraint.streams.common.AbstractConstraintStream<Solution_>
  • Field Details

  • Constructor Details

    • DroolsAbstractConstraintStream

      public DroolsAbstractConstraintStream(DroolsConstraintFactory<Solution_> constraintFactory, org.optaplanner.constraint.streams.common.RetrievalSemantics retrievalSemantics)
  • Method Details

    • buildConstraint

      protected org.optaplanner.core.api.score.stream.Constraint buildConstraint(String constraintPackage, String constraintName, org.optaplanner.core.api.score.Score<?> constraintWeight, org.optaplanner.constraint.streams.common.ScoreImpactType impactType, Object justificationMapping, Object indictedObjectsMapping, RuleBuilder<Solution_> ruleBuilder)
    • addChildStream

      public void addChildStream(DroolsAbstractConstraintStream<Solution_,?> childStream)
    • getChildStreams

      public Collection<DroolsAbstractConstraintStream<Solution_,?>> getChildStreams()
    • getConstraintFactory

      public DroolsConstraintFactory<Solution_> getConstraintFactory()
      Specified by:
      getConstraintFactory in interface org.optaplanner.core.api.score.stream.ConstraintStream
      Specified by:
      getConstraintFactory in class org.optaplanner.constraint.streams.common.AbstractConstraintStream<Solution_>
    • createLeftHandSide

      public abstract LHS_ createLeftHandSide()
      Some constructs in the Drools executable model may not be reused between different rules. They are, among others, variable instances and beta indexes. Therefore an instance of AbstractLeftHandSide must never be used to create more than one rule. Therefore every constraint stream re-creates the entire chain of left hand sides every time a new rule is built. It is then left up to Drools to node-share everything it can.
      Returns:
      never null, different instance on every call