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

## Class BavetAbstractBiConstraintStream<Solution_,A,B>

- java.lang.Object
- - org.optaplanner.core.impl.score.stream.common.AbstractConstraintStream<Solution_>
  - - org.optaplanner.core.impl.score.stream.bavet.common.BavetAbstractConstraintStream<Solution_>
    - - org.optaplanner.core.impl.score.stream.bavet.bi.BavetAbstractBiConstraintStream<Solution_,A,B>

- All Implemented Interfaces:
    BiConstraintStream<A,B>, ConstraintStream, InnerBiConstraintStream<A,B>
  Direct Known Subclasses:
    BavetFilterBiConstraintStream, BavetGroupBiConstraintStream, BavetJoinBiConstraintStream, BavetJoinBridgeBiConstraintStream, BavetScoringBiConstraintStream

      public abstract class BavetAbstractBiConstraintStream<Solution_,A,B>
      extends BavetAbstractConstraintStream<Solution_>
      implements InnerBiConstraintStream<A,B>

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected List<BavetAbstractBiConstraintStream<Solution_,A,B>>` | `childStreamList`

    - ### Fields inherited from class org.optaplanner.core.impl.score.stream.bavet.common.BavetAbstractConstraintStream

      `constraintFactory`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `BavetAbstractBiConstraintStream(BavetConstraintFactory<Solution_> constraintFactory)`

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected void` | `addChildStream(BavetAbstractBiConstraintStream<Solution_,A,B> childStream)`
    `protected void` | `createChildNodeChains(BavetNodeBuildPolicy<Solution_> buildPolicy, Score<?> constraintWeight, int nodeOrder, BavetAbstractBiNode<A,B> node)`
    `protected abstract BavetAbstractBiNode<A,B>` | `createNode(BavetNodeBuildPolicy<Solution_> buildPolicy, Score<?> constraintWeight, int nodeOrder, BavetAbstractBiNode<A,B> parentNode)`
    `BavetAbstractBiNode<A,B>` | `createNodeChain(BavetNodeBuildPolicy<Solution_> buildPolicy, Score<?> constraintWeight, int nodeOrder, BavetAbstractBiNode<A,B> parentNode)`
    `BavetAbstractBiConstraintStream<Solution_,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.
    `<GroupKey_> UniConstraintStream<GroupKey_>` | `groupBy(BiFunction<A,B,GroupKey_> groupKeyMapping)`
    `<GroupKey_,ResultContainer_,Result_> BiConstraintStream<GroupKey_,Result_>` | `groupBy(BiFunction<A,B,GroupKey_> groupKeyMapping, BiConstraintCollector<A,B,ResultContainer_,Result_> collector)`
    `<GroupKeyA_,GroupKeyB_> BiConstraintStream<GroupKeyA_,GroupKeyB_>` | `groupBy(BiFunction<A,B,GroupKeyA_> groupKeyAMapping, BiFunction<A,B,GroupKeyB_> groupKeyBMapping)`
    `<GroupKeyA_,GroupKeyB_,ResultContainer_,Result_> TriConstraintStream<GroupKeyA_,GroupKeyB_,Result_>` | `groupBy(BiFunction<A,B,GroupKeyA_> groupKeyAMapping, BiFunction<A,B,GroupKeyB_> groupKeyBMapping, BiConstraintCollector<A,B,ResultContainer_,Result_> collector)`
    `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).
    `protected BavetAbstractBiNode<A,B>` | `processNode(BavetNodeBuildPolicy<Solution_> buildPolicy, int nodeOrder, BavetAbstractBiNode<A,B> parentNode, BavetAbstractBiNode<A,B> node)`

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

      `buildConstraint, buildConstraintConfigurable, getConstraintFactory, getFromStreamList`

    - ### 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`

- - ### Field Detail

    - #### childStreamList

          protected final List<BavetAbstractBiConstraintStream<Solution_,A,B>> childStreamList

  - ### Constructor Detail

    - #### BavetAbstractBiConstraintStream

          public BavetAbstractBiConstraintStream(BavetConstraintFactory<Solution_> constraintFactory)

  - ### Method Detail

    - #### addChildStream

          protected void addChildStream(BavetAbstractBiConstraintStream<Solution_,A,B> childStream)

    - #### filter

          public BavetAbstractBiConstraintStream<Solution_,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

    - #### groupBy

          public <GroupKey_> UniConstraintStream<GroupKey_> groupBy(BiFunction<A,B,GroupKey_> groupKeyMapping)

      Specified by:
        `groupBy` in interface `BiConstraintStream<A,B>`

    - #### groupBy

          public <GroupKey_,ResultContainer_,Result_> BiConstraintStream<GroupKey_,Result_> groupBy(BiFunction<A,B,GroupKey_> groupKeyMapping,
                                                                                                    BiConstraintCollector<A,B,ResultContainer_,Result_> collector)

      Specified by:
        `groupBy` in interface `BiConstraintStream<A,B>`

    - #### groupBy

          public <GroupKeyA_,GroupKeyB_> BiConstraintStream<GroupKeyA_,GroupKeyB_> groupBy(BiFunction<A,B,GroupKeyA_> groupKeyAMapping,
                                                                                           BiFunction<A,B,GroupKeyB_> groupKeyBMapping)

      Specified by:
        `groupBy` in interface `BiConstraintStream<A,B>`

    - #### groupBy

          public <GroupKeyA_,GroupKeyB_,ResultContainer_,Result_> TriConstraintStream<GroupKeyA_,GroupKeyB_,Result_> groupBy(BiFunction<A,B,GroupKeyA_> groupKeyAMapping,
                                                                                                                             BiFunction<A,B,GroupKeyB_> groupKeyBMapping,
                                                                                                                             BiConstraintCollector<A,B,ResultContainer_,Result_> collector)

      Specified by:
        `groupBy` in interface `BiConstraintStream<A,B>`

    - #### 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>`

    - #### createNodeChain

          public BavetAbstractBiNode<A,B> createNodeChain(BavetNodeBuildPolicy<Solution_> buildPolicy,
                                                          Score<?> constraintWeight,
                                                          int nodeOrder,
                                                          BavetAbstractBiNode<A,B> parentNode)

    - #### processNode

          protected BavetAbstractBiNode<A,B> processNode(BavetNodeBuildPolicy<Solution_> buildPolicy,
                                                         int nodeOrder,
                                                         BavetAbstractBiNode<A,B> parentNode,
                                                         BavetAbstractBiNode<A,B> node)

    - #### createChildNodeChains

          protected void createChildNodeChains(BavetNodeBuildPolicy<Solution_> buildPolicy,
                                               Score<?> constraintWeight,
                                               int nodeOrder,
                                               BavetAbstractBiNode<A,B> node)

    - #### createNode

          protected abstract BavetAbstractBiNode<A,B> createNode(BavetNodeBuildPolicy<Solution_> buildPolicy,
                                                                 Score<?> constraintWeight,
                                                                 int nodeOrder,
                                                                 BavetAbstractBiNode<A,B> parentNode)

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