org.optaplanner.core.impl.score.stream.drools.bi

## Class DroolsAbstractBiConstraintStream<Solution_,A,B>

- java.lang.Object
- - org.optaplanner.core.impl.score.stream.common.AbstractConstraintStream<Solution_>
  - - org.optaplanner.core.impl.score.stream.drools.common.DroolsAbstractConstraintStream<Solution_>
    - - org.optaplanner.core.impl.score.stream.drools.bi.DroolsAbstractBiConstraintStream<Solution_,A,B>

- All Implemented Interfaces:
    BiConstraintStream<A,B>, ConstraintStream, InnerBiConstraintStream<A,B>
  Direct Known Subclasses:
    DroolsFilterBiConstraintStream, DroolsGroupingBiConstraintStream, DroolsJoinBiConstraintStream, DroolsScoringBiConstraintStream

      public abstract class DroolsAbstractBiConstraintStream<Solution_,A,B>
      extends DroolsAbstractConstraintStream<Solution_>
      implements InnerBiConstraintStream<A,B>

- - ### Field Summary

    - ### Fields inherited from class org.optaplanner.core.impl.score.stream.drools.common.DroolsAbstractConstraintStream

      `constraintFactory`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `DroolsAbstractBiConstraintStream(DroolsConstraintFactory<Solution_> constraintFactory)`

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `abstract DroolsBiCondition<A,B>` | `createCondition()`
    `BiConstraintStream<A,B>` | `filter(BiPredicate<A,B> predicate)` Exhaustively test each tuple of facts against the `BiPredicate` and match if `BiPredicate.test(Object, Object)` returns true.
    `List<DroolsFromUniConstraintStream<Solution_,Object>>` | `getFromStreamList()`
    `protected abstract DroolsAbstractConstraintStream<Solution_>` | `getParent()`
    `Constraint` | `impactScore(String constraintPackage, String constraintName, Score<?> constraintWeight, boolean positive)`
    `Constraint` | `impactScore(String constraintPackage, String constraintName, Score<?> constraintWeight, ToIntBiFunction<A,B> matchWeigher, boolean positive)`
    `Constraint` | `impactScoreBigDecimal(String constraintPackage, String constraintName, Score<?> constraintWeight, BiFunction<A,B,BigDecimal> matchWeigher, boolean positive)`
    `Constraint` | `impactScoreConfigurable(String constraintPackage, String constraintName, boolean positive)`
    `Constraint` | `impactScoreConfigurable(String constraintPackage, String constraintName, ToIntBiFunction<A,B> matchWeigher, boolean positive)`
    `Constraint` | `impactScoreConfigurableBigDecimal(String constraintPackage, String constraintName, BiFunction<A,B,BigDecimal> matchWeigher, boolean positive)`
    `Constraint` | `impactScoreConfigurableLong(String constraintPackage, String constraintName, ToLongBiFunction<A,B> matchWeigher, boolean positive)`
    `Constraint` | `impactScoreLong(String constraintPackage, String constraintName, Score<?> constraintWeight, ToLongBiFunction<A,B> matchWeigher, boolean positive)`
    `<C> TriConstraintStream<A,B,C>` | `join(UniConstraintStream<C> otherStream, TriJoiner<A,B,C> joiner)` Create a new `TriConstraintStream` for every combination of [A, B] and C for which the `BiJoiner` is true (for the properties it extracts from both facts).

    - ### Methods inherited from class org.optaplanner.core.impl.score.stream.drools.common.DroolsAbstractConstraintStream

      `addChildStream, buildConstraint, buildConstraintConfigurable, buildRule, getChildStreams, getConstraintFactory`

    - ### Methods inherited from class org.optaplanner.core.impl.score.stream.common.AbstractConstraintStream

      `buildConstraintWeightExtractor, buildConstraintWeightExtractor, penalize, penalizeConfigurable, reward, rewardConfigurable, validateConstraintId`

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

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

    - ### Methods inherited from interface org.optaplanner.core.impl.score.stream.bi.InnerBiConstraintStream

      `penalize, penalizeBigDecimal, penalizeConfigurable, penalizeConfigurableBigDecimal, penalizeConfigurableLong, penalizeLong, reward, rewardBigDecimal, rewardConfigurable, rewardConfigurableBigDecimal, rewardConfigurableLong, rewardLong`

    - ### Methods inherited from interface org.optaplanner.core.api.score.stream.bi.BiConstraintStream

      `join, join, join, join, join, join, join, penalize, penalizeBigDecimal, penalizeConfigurable, penalizeConfigurableBigDecimal, penalizeConfigurableLong, penalizeLong, reward, rewardBigDecimal, rewardConfigurable, rewardConfigurableBigDecimal, rewardConfigurableLong, rewardLong`

    - ### Methods inherited from interface org.optaplanner.core.api.score.stream.ConstraintStream

      `getConstraintFactory, penalize, penalize, penalizeConfigurable, penalizeConfigurable, reward, reward, rewardConfigurable, rewardConfigurable`

- - ### Constructor Detail

    - #### DroolsAbstractBiConstraintStream

          public DroolsAbstractBiConstraintStream(DroolsConstraintFactory<Solution_> constraintFactory)

  - ### Method Detail

    - #### filter

          public BiConstraintStream<A,B> filter(BiPredicate<A,B> predicate)

      Description copied from interface: `BiConstraintStream`
      Exhaustively test each tuple of facts against the `BiPredicate` and match if `BiPredicate.test(Object, Object)` returns true.

      Important: This is slower and less scalable than `UniConstraintStream#join(UniConstraintStream, BiJoiner[])` with a proper `BiJoiner` predicate (such as `Joiners.equal(Function, Function)`, because the latter applies hashing and/or indexing, so it doesn't create every combination just to filter it out.

      Specified by:
        `filter` in interface `BiConstraintStream<A,B>`
      Parameters:
        `predicate` - never null
      Returns:
        never null

    - #### join

          public <C> TriConstraintStream<A,B,C> join(UniConstraintStream<C> otherStream,
                                                     TriJoiner<A,B,C> joiner)

      Description copied from interface: `BiConstraintStream`
      Create a new `TriConstraintStream` for every combination of [A, B] and C for which the `BiJoiner` is true (for the properties it extracts from both facts).

      Important: This is faster and more scalable than a `join` followed by a `filter`, because it applies hashing and/or indexing on the properties, so it doesn't create nor checks every combination of [A, B] and C.

      Specified by:
        `join` in interface `BiConstraintStream<A,B>`
      Type Parameters:
        `C` - the type of the third matched fact
      Parameters:
        `otherStream` - never null
        `joiner` - never null
      Returns:
        a stream that matches every combination of [A, B] and C for which the `BiJoiner` is true

    - #### impactScore

          public final Constraint impactScore(String constraintPackage,
                                              String constraintName,
                                              Score<?> constraintWeight,
                                              boolean positive)

      Specified by:
        `impactScore` in class `AbstractConstraintStream<Solution_>`

    - #### impactScore

          public final Constraint impactScore(String constraintPackage,
                                              String constraintName,
                                              Score<?> constraintWeight,
                                              ToIntBiFunction<A,B> matchWeigher,
                                              boolean positive)

      Specified by:
        `impactScore` in interface `InnerBiConstraintStream<A,B>`

    - #### impactScoreLong

          public final Constraint impactScoreLong(String constraintPackage,
                                                  String constraintName,
                                                  Score<?> constraintWeight,
                                                  ToLongBiFunction<A,B> matchWeigher,
                                                  boolean positive)

      Specified by:
        `impactScoreLong` in interface `InnerBiConstraintStream<A,B>`

    - #### impactScoreBigDecimal

          public final Constraint impactScoreBigDecimal(String constraintPackage,
                                                        String constraintName,
                                                        Score<?> constraintWeight,
                                                        BiFunction<A,B,BigDecimal> matchWeigher,
                                                        boolean positive)

      Specified by:
        `impactScoreBigDecimal` in interface `InnerBiConstraintStream<A,B>`

    - #### impactScoreConfigurable

          public final Constraint impactScoreConfigurable(String constraintPackage,
                                                          String constraintName,
                                                          boolean positive)

      Specified by:
        `impactScoreConfigurable` in class `AbstractConstraintStream<Solution_>`

    - #### impactScoreConfigurable

          public final Constraint impactScoreConfigurable(String constraintPackage,
                                                          String constraintName,
                                                          ToIntBiFunction<A,B> matchWeigher,
                                                          boolean positive)

      Specified by:
        `impactScoreConfigurable` in interface `InnerBiConstraintStream<A,B>`

    - #### impactScoreConfigurableLong

          public final Constraint impactScoreConfigurableLong(String constraintPackage,
                                                              String constraintName,
                                                              ToLongBiFunction<A,B> matchWeigher,
                                                              boolean positive)

      Specified by:
        `impactScoreConfigurableLong` in interface `InnerBiConstraintStream<A,B>`

    - #### impactScoreConfigurableBigDecimal

          public final Constraint impactScoreConfigurableBigDecimal(String constraintPackage,
                                                                    String constraintName,
                                                                    BiFunction<A,B,BigDecimal> matchWeigher,
                                                                    boolean positive)

      Specified by:
        `impactScoreConfigurableBigDecimal` in interface `InnerBiConstraintStream<A,B>`

    - #### getFromStreamList

          public List<DroolsFromUniConstraintStream<Solution_,Object>> getFromStreamList()

      Specified by:
        `getFromStreamList` in class `DroolsAbstractConstraintStream<Solution_>`

    - #### getParent

          protected abstract DroolsAbstractConstraintStream<Solution_> getParent()

    - #### createCondition

          public abstract DroolsBiCondition<A,B> createCondition()

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