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

## Class DroolsAbstractUniConstraintStream<Solution_,A>

- 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.uni.DroolsAbstractUniConstraintStream<Solution_,A>

- All Implemented Interfaces:
    ConstraintStream, UniConstraintStream<A>, InnerUniConstraintStream<A>
  Direct Known Subclasses:
    DroolsFilterUniConstraintStream, DroolsFromUniConstraintStream, DroolsGroupingUniConstraintStream, DroolsScoringUniConstraintStream

      public abstract class DroolsAbstractUniConstraintStream<Solution_,A>
      extends DroolsAbstractConstraintStream<Solution_>
      implements InnerUniConstraintStream<A>

- - ### Field Summary

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

      `constraintFactory`

  - ### Constructor Summary

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

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `abstract DroolsUniCondition<A>` | `createCondition()`
    `DroolsAbstractUniConstraintStream<Solution_,A>` | `filter(Predicate<A> predicate)` Exhaustively test each fact against the `Predicate` and match if `Predicate.test(Object)` returns true.
    `<GroupKey_> UniConstraintStream<GroupKey_>` | `groupBy(Function<A,GroupKey_> groupKeyMapping)` Convert the `UniConstraintStream` to a different `UniConstraintStream`, containing of 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(Function<A,GroupKey_> groupKeyMapping, UniConstraintCollector<A,ResultContainer_,Result_> collector)` Convert the `UniConstraintStream` to a `BiConstraintStream`, consisting of tuples which have: As the first fact, the value resulting from applying the group key mapping function on the fact from the original tuple.
    `<ResultContainer_,Result_> UniConstraintStream<Result_>` | `groupBy(UniConstraintCollector<A,ResultContainer_,Result_> collector)` Runs all tuples of the stream through a given @`UniConstraintCollector` and converts them into a new `UniConstraintStream` which only has a single tuple, the result of applying `UniConstraintCollector`.
    `Constraint` | `impactScore(String constraintPackage, String constraintName, Score<?> constraintWeight, boolean positive)`
    `Constraint` | `impactScore(String constraintPackage, String constraintName, Score<?> constraintWeight, ToIntFunction<A> matchWeigher, boolean positive)`
    `Constraint` | `impactScoreBigDecimal(String constraintPackage, String constraintName, Score<?> constraintWeight, Function<A,BigDecimal> matchWeigher, boolean positive)`
    `Constraint` | `impactScoreConfigurable(String constraintPackage, String constraintName, boolean positive)`
    `Constraint` | `impactScoreConfigurable(String constraintPackage, String constraintName, ToIntFunction<A> matchWeigher, boolean positive)`
    `Constraint` | `impactScoreConfigurableBigDecimal(String constraintPackage, String constraintName, Function<A,BigDecimal> matchWeigher, boolean positive)`
    `Constraint` | `impactScoreConfigurableLong(String constraintPackage, String constraintName, ToLongFunction<A> matchWeigher, boolean positive)`
    `Constraint` | `impactScoreLong(String constraintPackage, String constraintName, Score<?> constraintWeight, ToLongFunction<A> matchWeigher, boolean positive)`
    `<B> BiConstraintStream<A,B>` | `join(UniConstraintStream<B> otherStream, BiJoiner<A,B> joiner)` Create a new `BiConstraintStream` for every combination of A and B 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, 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.uni.InnerUniConstraintStream

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

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

      `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

    - #### DroolsAbstractUniConstraintStream

          public DroolsAbstractUniConstraintStream(DroolsConstraintFactory<Solution_> constraintFactory)

  - ### Method Detail

    - #### filter

          public DroolsAbstractUniConstraintStream<Solution_,A> filter(Predicate<A> predicate)

      Description copied from interface: `UniConstraintStream`
      Exhaustively test each fact against the `Predicate` and match if `Predicate.test(Object)` returns true.
      Specified by:
        `filter` in interface `UniConstraintStream<A>`
      Parameters:
        `predicate` - never null
      Returns:
        never null

    - #### join

          public <B> BiConstraintStream<A,B> join(UniConstraintStream<B> otherStream,
                                                  BiJoiner<A,B> joiner)

      Description copied from interface: `UniConstraintStream`
      Create a new `BiConstraintStream` for every combination of A and B 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 and B.

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

    - #### groupBy

          public <ResultContainer_,Result_> UniConstraintStream<Result_> groupBy(UniConstraintCollector<A,ResultContainer_,Result_> collector)

      Description copied from interface: `UniConstraintStream`
      Runs all tuples of the stream through a given @`UniConstraintCollector` and converts them into a new `UniConstraintStream` which only has a single tuple, the result of applying `UniConstraintCollector`.
      Specified by:
        `groupBy` in interface `UniConstraintStream<A>`
      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
      Returns:
        never null

    - #### groupBy

          public <GroupKey_> UniConstraintStream<GroupKey_> groupBy(Function<A,GroupKey_> groupKeyMapping)

      Description copied from interface: `UniConstraintStream`
      Convert the `UniConstraintStream` to a different `UniConstraintStream`, containing of 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 will `Objects.equals(Object, Object)` any other.
      Specified by:
        `groupBy` in interface `UniConstraintStream<A>`
      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(Function<A,GroupKey_> groupKeyMapping,
                                                                                                    UniConstraintCollector<A,ResultContainer_,Result_> collector)

      Description copied from interface: `UniConstraintStream`
      Convert the `UniConstraintStream` to a `BiConstraintStream`, consisting of tuples which have:
      - As the first fact, the value resulting from applying the group key mapping function on the fact from the original tuple. Neither such facts of the new stream will `Objects.equals(Object, Object)` any other.
      - As the second fact, the value of applying a given `UniConstraintCollector` on all the facts of the original tuple with a matching group key.
      Specified by:
        `groupBy` in interface `UniConstraintStream<A>`
      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 a fact in original tuple to a different fact
      Returns:
        never null

    - #### 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,
                                              ToIntFunction<A> matchWeigher,
                                              boolean positive)

      Specified by:
        `impactScore` in interface `InnerUniConstraintStream<A>`

    - #### impactScoreLong

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

      Specified by:
        `impactScoreLong` in interface `InnerUniConstraintStream<A>`

    - #### impactScoreBigDecimal

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

      Specified by:
        `impactScoreBigDecimal` in interface `InnerUniConstraintStream<A>`

    - #### 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,
                                                          ToIntFunction<A> matchWeigher,
                                                          boolean positive)

      Specified by:
        `impactScoreConfigurable` in interface `InnerUniConstraintStream<A>`

    - #### impactScoreConfigurableLong

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

      Specified by:
        `impactScoreConfigurableLong` in interface `InnerUniConstraintStream<A>`

    - #### impactScoreConfigurableBigDecimal

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

      Specified by:
        `impactScoreConfigurableBigDecimal` in interface `InnerUniConstraintStream<A>`

    - #### createCondition

          public abstract DroolsUniCondition<A> createCondition()

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