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

## Class DroolsAbstractQuadConstraintStream<Solution_,A,B,C,D>

- 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.quad.DroolsAbstractQuadConstraintStream<Solution_,A,B,C,D>

- All Implemented Interfaces:
    ConstraintStream, QuadConstraintStream<A,B,C,D>, InnerQuadConstraintStream<A,B,C,D>
  Direct Known Subclasses:
    DroolsExistsQuadConstraintStream, DroolsFilterQuadConstraintStream, DroolsGroupingQuadConstraintStream, DroolsJoinQuadConstraintStream, DroolsScoringQuadConstraintStream

      public abstract class DroolsAbstractQuadConstraintStream<Solution_,A,B,C,D>
      extends DroolsAbstractConstraintStream<Solution_>
      implements InnerQuadConstraintStream<A,B,C,D>

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected DroolsAbstractConstraintStream<Solution_>` | `parent`

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

      `constraintFactory`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `DroolsAbstractQuadConstraintStream(DroolsConstraintFactory<Solution_> constraintFactory, DroolsAbstractConstraintStream<Solution_> parent)`

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `QuadConstraintStream<A,B,C,D>` | `filter(QuadPredicate<A,B,C,D> predicate)` Exhaustively test each tuple of facts against the `QuadPredicate` and match if `QuadPredicate.test(Object, Object, Object, Object)` returns true.
    `int` | `getCardinality()`
    `abstract DroolsQuadCondition<A,B,C,D,?>` | `getCondition()`
    `List<DroolsFromUniConstraintStream<Solution_,Object>>` | `getFromStreamList()`
    `<ResultContainer_,Result_> UniConstraintStream<Result_>` | `groupBy(QuadConstraintCollector<A,B,C,D,ResultContainer_,Result_> collector)` Convert the `QuadConstraintStream` to a `UniConstraintStream`, containing only a single tuple, the result of applying `QuadConstraintCollector`.
    `<GroupKey_> UniConstraintStream<GroupKey_>` | `groupBy(QuadFunction<A,B,C,D,GroupKey_> groupKeyMapping)` Convert the `QuadConstraintStream` to a `UniConstraintStream`, containing the set of tuples resulting from applying the group key mapping function on all tuples of the original stream.
    `<GroupKey_,ResultContainer_,Result_> BiConstraintStream<GroupKey_,Result_>` | `groupBy(QuadFunction<A,B,C,D,GroupKey_> groupKeyMapping, QuadConstraintCollector<A,B,C,D,ResultContainer_,Result_> collector)` Convert the `QuadConstraintStream` to a `BiConstraintStream`, consisting of unique tuples.
    `<GroupKeyA_,GroupKeyB_> BiConstraintStream<GroupKeyA_,GroupKeyB_>` | `groupBy(QuadFunction<A,B,C,D,GroupKeyA_> groupKeyAMapping, QuadFunction<A,B,C,D,GroupKeyB_> groupKeyBMapping)` Convert the `QuadConstraintStream` to a `BiConstraintStream`, consisting of unique tuples.
    `<GroupKeyA_,GroupKeyB_,ResultContainer_,Result_> TriConstraintStream<GroupKeyA_,GroupKeyB_,Result_>` | `groupBy(QuadFunction<A,B,C,D,GroupKeyA_> groupKeyAMapping, QuadFunction<A,B,C,D,GroupKeyB_> groupKeyBMapping, QuadConstraintCollector<A,B,C,D,ResultContainer_,Result_> collector)` Combines the semantics of `QuadConstraintStream.groupBy(QuadFunction, QuadFunction)` and `QuadConstraintStream.groupBy(QuadConstraintCollector)`.
    `<GroupKeyA_,GroupKeyB_,ResultContainerC_,ResultC_,ResultContainerD_,ResultD_> QuadConstraintStream<GroupKeyA_,GroupKeyB_,ResultC_,ResultD_>` | `groupBy(QuadFunction<A,B,C,D,GroupKeyA_> groupKeyAMapping, QuadFunction<A,B,C,D,GroupKeyB_> groupKeyBMapping, QuadConstraintCollector<A,B,C,D,ResultContainerC_,ResultC_> collectorC, QuadConstraintCollector<A,B,C,D,ResultContainerD_,ResultD_> collectorD)` Combines the semantics of `QuadConstraintStream.groupBy(QuadFunction, QuadFunction)` and `QuadConstraintStream.groupBy(QuadConstraintCollector)`.
    `<E> QuadConstraintStream<A,B,C,D>` | `ifExists(Class<E> otherClass, PentaJoiner<A,B,C,D,E>... joiners)` As defined by `QuadConstraintStream.ifExists(Class, PentaJoiner)`.
    `<E> QuadConstraintStream<A,B,C,D>` | `ifNotExists(Class<E> otherClass, PentaJoiner<A,B,C,D,E>... joiners)` As defined by `QuadConstraintStream.ifNotExists(Class, PentaJoiner)`.
    `protected Constraint` | `impactScore(String constraintPackage, String constraintName, Score<?> constraintWeight, ScoreImpactType impactType)`
    `Constraint` | `impactScore(String constraintPackage, String constraintName, Score<?> constraintWeight, ToIntQuadFunction<A,B,C,D> matchWeigher, ScoreImpactType impactType)`
    `Constraint` | `impactScoreBigDecimal(String constraintPackage, String constraintName, Score<?> constraintWeight, QuadFunction<A,B,C,D,BigDecimal> matchWeigher, ScoreImpactType impactType)`
    `protected Constraint` | `impactScoreConfigurable(String constraintPackage, String constraintName, ScoreImpactType impactType)`
    `Constraint` | `impactScoreConfigurable(String constraintPackage, String constraintName, ToIntQuadFunction<A,B,C,D> matchWeigher, ScoreImpactType impactType)`
    `Constraint` | `impactScoreConfigurableBigDecimal(String constraintPackage, String constraintName, QuadFunction<A,B,C,D,BigDecimal> matchWeigher, ScoreImpactType impactType)`
    `Constraint` | `impactScoreConfigurableLong(String constraintPackage, String constraintName, ToLongQuadFunction<A,B,C,D> matchWeigher, ScoreImpactType impactType)`
    `Constraint` | `impactScoreLong(String constraintPackage, String constraintName, Score<?> constraintWeight, ToLongQuadFunction<A,B,C,D> matchWeigher, ScoreImpactType impactType)`

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

      `addChildStream, buildConstraint, buildConstraintConfigurable, createRuleItemBuilders, getChildStreams, getConstraintFactory, getExpectedJustificationTypes`

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

      `buildConstraintWeightExtractor, buildConstraintWeightExtractor, impact, penalize, penalizeConfigurable, reward, rewardConfigurable`

    - ### 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.quad.InnerQuadConstraintStream

      `impact, impactBigDecimal, impactConfigurable, impactConfigurableBigDecimal, impactConfigurableLong, impactLong, penalize, penalizeBigDecimal, penalizeConfigurable, penalizeConfigurableBigDecimal, penalizeConfigurableLong, penalizeLong, reward, rewardBigDecimal, rewardConfigurable, rewardConfigurableBigDecimal, rewardConfigurableLong, rewardLong`

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

      `ifExists, ifExists, ifExists, ifExists, ifNotExists, ifNotExists, ifNotExists, ifNotExists, impact, impactBigDecimal, impactConfigurable, impactConfigurableBigDecimal, impactConfigurableLong, impactLong, penalize, penalizeBigDecimal, penalizeConfigurable, penalizeConfigurableBigDecimal, penalizeConfigurableLong, penalizeLong, reward, rewardBigDecimal, rewardConfigurable, rewardConfigurableBigDecimal, rewardConfigurableLong, rewardLong`

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

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

- - ### Field Detail

    - #### parent

          protected final DroolsAbstractConstraintStream<Solution_> parent

  - ### Constructor Detail

    - #### DroolsAbstractQuadConstraintStream

          public DroolsAbstractQuadConstraintStream(DroolsConstraintFactory<Solution_> constraintFactory,
                                                    DroolsAbstractConstraintStream<Solution_> parent)

  - ### Method Detail

    - #### getCardinality

          public int getCardinality()

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

    - #### filter

          public QuadConstraintStream<A,B,C,D> filter(QuadPredicate<A,B,C,D> predicate)

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

      Important: This is slower and less scalable than `TriConstraintStream.join(UniConstraintStream, QuadJoiner)` with a proper `QuadJoiner` predicate (such as `Joiners.equal(TriFunction, 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 `QuadConstraintStream<A,B,C,D>`
      Parameters:
        `predicate` - never null
      Returns:
        never null

    - #### ifExists

          @SafeVarargs
          public final <E> QuadConstraintStream<A,B,C,D> ifExists(Class<E> otherClass,
                                                                               PentaJoiner<A,B,C,D,E>... joiners)

      Description copied from interface: `QuadConstraintStream`
      As defined by `QuadConstraintStream.ifExists(Class, PentaJoiner)`. For performance reasons, indexing joiners must be placed before filtering joiners.

      This method causes Unchecked generics array creation for varargs parameter warnings, but we can't fix it with a `SafeVarargs` annotation because it's an interface method. Therefore, there are overloaded methods with up to 4 `PentaJoiner` parameters.

      Specified by:
        `ifExists` in interface `QuadConstraintStream<A,B,C,D>`
      Type Parameters:
        `E` - the type of the fifth matched fact
      Parameters:
        `otherClass` - never null
        `joiners` - never null
      Returns:
        never null, a stream that matches every tuple of A, B, C and D where E exists for which the `PentaJoiner`s are true

    - #### ifNotExists

          @SafeVarargs
          public final <E> QuadConstraintStream<A,B,C,D> ifNotExists(Class<E> otherClass,
                                                                                  PentaJoiner<A,B,C,D,E>... joiners)

      Description copied from interface: `QuadConstraintStream`
      As defined by `QuadConstraintStream.ifNotExists(Class, PentaJoiner)`. For performance reasons, indexing joiners must be placed before filtering joiners.

      This method causes Unchecked generics array creation for varargs parameter warnings, but we can't fix it with a `SafeVarargs` annotation because it's an interface method. Therefore, there are overloaded methods with up to 4 `PentaJoiner` parameters.

      Specified by:
        `ifNotExists` in interface `QuadConstraintStream<A,B,C,D>`
      Type Parameters:
        `E` - the type of the fifth matched fact
      Parameters:
        `otherClass` - never null
        `joiners` - never null
      Returns:
        never null, a stream that matches every tuple of A, B, C and D where E does not exist for which the `PentaJoiner`s are true

    - #### groupBy

          public <ResultContainer_,Result_> UniConstraintStream<Result_> groupBy(QuadConstraintCollector<A,B,C,D,ResultContainer_,Result_> collector)

      Description copied from interface: `QuadConstraintStream`
      Convert the `QuadConstraintStream` to a `UniConstraintStream`, containing only a single tuple, the result of applying `QuadConstraintCollector`. `UniConstraintStream` which only has a single tuple, the result of applying `QuadConstraintCollector`.
      Specified by:
        `groupBy` in interface `QuadConstraintStream<A,B,C,D>`
      Type Parameters:
        `ResultContainer_` - the mutable accumulation type (often hidden as an implementation detail)
        `Result_` - the type of a fact in the destination `UniConstraintStream`'s tuple
      Parameters:
        `collector` - never null, the collector to perform the grouping operation with See `ConstraintCollectors` for common operations, such as `count()`, `sum()` and others.
      Returns:
        never null

    - #### groupBy

          public <GroupKey_> UniConstraintStream<GroupKey_> groupBy(QuadFunction<A,B,C,D,GroupKey_> groupKeyMapping)

      Description copied from interface: `QuadConstraintStream`
      Convert the `QuadConstraintStream` to a `UniConstraintStream`, containing the set of tuples resulting from applying the group key mapping function on all tuples of the original stream. Neither tuple of the new stream `Objects.equals(Object, Object)` any other.
      Specified by:
        `groupBy` in interface `QuadConstraintStream<A,B,C,D>`
      Type Parameters:
        `GroupKey_` - the type of a fact in the destination `UniConstraintStream`'s tuple
      Parameters:
        `groupKeyMapping` - never null, mapping function to convert each element in the stream to a different element
      Returns:
        never null

    - #### groupBy

          public <GroupKey_,ResultContainer_,Result_> BiConstraintStream<GroupKey_,Result_> groupBy(QuadFunction<A,B,C,D,GroupKey_> groupKeyMapping,
                                                                                                    QuadConstraintCollector<A,B,C,D,ResultContainer_,Result_> collector)

      Description copied from interface: `QuadConstraintStream`
      Convert the `QuadConstraintStream` to a `BiConstraintStream`, consisting of unique tuples.

      The first fact is the return value of the first group key mapping function, applied on the incoming tuple. The second fact is the return value of a given `QuadConstraintCollector` applied on all incoming tuples with the same first fact.

      Specified by:
        `groupBy` in interface `QuadConstraintStream<A,B,C,D>`
      Type Parameters:
        `GroupKey_` - the type of the first fact in the destination `BiConstraintStream`'s tuple
        `ResultContainer_` - the mutable accumulation type (often hidden as an implementation detail)
        `Result_` - the type of the second fact in the destination `BiConstraintStream`'s tuple
      Parameters:
        `groupKeyMapping` - never null, function to convert the fact in the original tuple to a different fact
        `collector` - never null, the collector to perform the grouping operation with See `ConstraintCollectors` for common operations, such as `count()`, `sum()` and others.
      Returns:
        never null

    - #### groupBy

          public <GroupKeyA_,GroupKeyB_> BiConstraintStream<GroupKeyA_,GroupKeyB_> groupBy(QuadFunction<A,B,C,D,GroupKeyA_> groupKeyAMapping,
                                                                                           QuadFunction<A,B,C,D,GroupKeyB_> groupKeyBMapping)

      Description copied from interface: `QuadConstraintStream`
      Convert the `QuadConstraintStream` to a `BiConstraintStream`, consisting of unique tuples.

      The first fact is the return value of the first group key mapping function, applied on the incoming tuple. The second fact is the return value of the second group key mapping function, applied on all incoming tuples with the same first fact.

      Specified by:
        `groupBy` in interface `QuadConstraintStream<A,B,C,D>`
      Type Parameters:
        `GroupKeyA_` - the type of the first fact in the destination `BiConstraintStream`'s tuple
        `GroupKeyB_` - the type of the second fact in the destination `BiConstraintStream`'s tuple
      Parameters:
        `groupKeyAMapping` - never null, function to convert the facts in the original tuple to a new fact
        `groupKeyBMapping` - never null, function to convert the facts in the original tuple to another new fact
      Returns:
        never null

    - #### groupBy

          public <GroupKeyA_,GroupKeyB_,ResultContainer_,Result_> TriConstraintStream<GroupKeyA_,GroupKeyB_,Result_> groupBy(QuadFunction<A,B,C,D,GroupKeyA_> groupKeyAMapping,
                                                                                                                             QuadFunction<A,B,C,D,GroupKeyB_> groupKeyBMapping,
                                                                                                                             QuadConstraintCollector<A,B,C,D,ResultContainer_,Result_> collector)

      Description copied from interface: `QuadConstraintStream`
      Combines the semantics of `QuadConstraintStream.groupBy(QuadFunction, QuadFunction)` and `QuadConstraintStream.groupBy(QuadConstraintCollector)`. That is, the first and second facts in the tuple follow the `QuadConstraintStream.groupBy(QuadFunction, QuadFunction)` semantics, and the third fact is the result of applying `QuadConstraintCollector.finisher()` on all the tuples of the original `UniConstraintStream` that belong to the group.
      Specified by:
        `groupBy` in interface `QuadConstraintStream<A,B,C,D>`
      Type Parameters:
        `GroupKeyA_` - the type of the first fact in the destination `TriConstraintStream`'s tuple
        `GroupKeyB_` - the type of the second fact in the destination `TriConstraintStream`'s tuple
        `ResultContainer_` - the mutable accumulation type (often hidden as an implementation detail)
        `Result_` - the type of the third fact in the destination `TriConstraintStream`'s tuple
      Parameters:
        `groupKeyAMapping` - never null, function to convert the original tuple into a first fact
        `groupKeyBMapping` - never null, function to convert the original tuple into a second fact
        `collector` - never null, the collector to perform the grouping operation with See `ConstraintCollectors` for common operations, such as `count()`, `sum()` and others.
      Returns:
        never null

    - #### groupBy

          public <GroupKeyA_,GroupKeyB_,ResultContainerC_,ResultC_,ResultContainerD_,ResultD_> QuadConstraintStream<GroupKeyA_,GroupKeyB_,ResultC_,ResultD_> groupBy(QuadFunction<A,B,C,D,GroupKeyA_> groupKeyAMapping,
                                                                                                                                                                     QuadFunction<A,B,C,D,GroupKeyB_> groupKeyBMapping,
                                                                                                                                                                     QuadConstraintCollector<A,B,C,D,ResultContainerC_,ResultC_> collectorC,
                                                                                                                                                                     QuadConstraintCollector<A,B,C,D,ResultContainerD_,ResultD_> collectorD)

      Description copied from interface: `QuadConstraintStream`
      Combines the semantics of `QuadConstraintStream.groupBy(QuadFunction, QuadFunction)` and `QuadConstraintStream.groupBy(QuadConstraintCollector)`. That is, the first and second facts in the tuple follow the `QuadConstraintStream.groupBy(QuadFunction, QuadFunction)` semantics. The third fact is the result of applying the first `QuadConstraintCollector.finisher()` on all the tuples of the original `QuadConstraintStream` that belong to the group. The fourth fact is the result of applying the second `QuadConstraintCollector.finisher()` on all the tuples of the original `QuadConstraintStream` that belong to the group
      Specified by:
        `groupBy` in interface `QuadConstraintStream<A,B,C,D>`
      Type Parameters:
        `GroupKeyA_` - the type of the first fact in the destination `QuadConstraintStream`'s tuple
        `GroupKeyB_` - the type of the second fact in the destination `QuadConstraintStream`'s tuple
        `ResultContainerC_` - the mutable accumulation type (often hidden as an implementation detail)
        `ResultC_` - the type of the third fact in the destination `QuadConstraintStream`'s tuple
        `ResultContainerD_` - the mutable accumulation type (often hidden as an implementation detail)
        `ResultD_` - the type of the fourth fact in the destination `QuadConstraintStream`'s tuple
      Parameters:
        `groupKeyAMapping` - never null, function to convert the original tuple into a first fact
        `groupKeyBMapping` - never null, function to convert the original tuple into a second fact
        `collectorC` - never null, the collector to perform the first grouping operation with See `ConstraintCollectors` for common operations, such as `count()`, `sum()` and others.
        `collectorD` - never null, the collector to perform the second grouping operation with See `ConstraintCollectors` for common operations, such as `count()`, `sum()` and others.
      Returns:
        never null

    - #### impactScore

          protected Constraint impactScore(String constraintPackage,
                                           String constraintName,
                                           Score<?> constraintWeight,
                                           ScoreImpactType impactType)

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

    - #### impactScore

          public Constraint impactScore(String constraintPackage,
                                        String constraintName,
                                        Score<?> constraintWeight,
                                        ToIntQuadFunction<A,B,C,D> matchWeigher,
                                        ScoreImpactType impactType)

      Specified by:
        `impactScore` in interface `InnerQuadConstraintStream<A,B,C,D>`

    - #### impactScoreLong

          public Constraint impactScoreLong(String constraintPackage,
                                            String constraintName,
                                            Score<?> constraintWeight,
                                            ToLongQuadFunction<A,B,C,D> matchWeigher,
                                            ScoreImpactType impactType)

      Specified by:
        `impactScoreLong` in interface `InnerQuadConstraintStream<A,B,C,D>`

    - #### impactScoreBigDecimal

          public Constraint impactScoreBigDecimal(String constraintPackage,
                                                  String constraintName,
                                                  Score<?> constraintWeight,
                                                  QuadFunction<A,B,C,D,BigDecimal> matchWeigher,
                                                  ScoreImpactType impactType)

      Specified by:
        `impactScoreBigDecimal` in interface `InnerQuadConstraintStream<A,B,C,D>`

    - #### impactScoreConfigurable

          protected Constraint impactScoreConfigurable(String constraintPackage,
                                                       String constraintName,
                                                       ScoreImpactType impactType)

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

    - #### impactScoreConfigurable

          public Constraint impactScoreConfigurable(String constraintPackage,
                                                    String constraintName,
                                                    ToIntQuadFunction<A,B,C,D> matchWeigher,
                                                    ScoreImpactType impactType)

      Specified by:
        `impactScoreConfigurable` in interface `InnerQuadConstraintStream<A,B,C,D>`

    - #### impactScoreConfigurableLong

          public Constraint impactScoreConfigurableLong(String constraintPackage,
                                                        String constraintName,
                                                        ToLongQuadFunction<A,B,C,D> matchWeigher,
                                                        ScoreImpactType impactType)

      Specified by:
        `impactScoreConfigurableLong` in interface `InnerQuadConstraintStream<A,B,C,D>`

    - #### impactScoreConfigurableBigDecimal

          public Constraint impactScoreConfigurableBigDecimal(String constraintPackage,
                                                              String constraintName,
                                                              QuadFunction<A,B,C,D,BigDecimal> matchWeigher,
                                                              ScoreImpactType impactType)

      Specified by:
        `impactScoreConfigurableBigDecimal` in interface `InnerQuadConstraintStream<A,B,C,D>`

    - #### getFromStreamList

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

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

    - #### getCondition

          public abstract DroolsQuadCondition<A,B,C,D,?> getCondition()

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