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

## Class DroolsUniCondition<A>

- java.lang.Object
- - org.optaplanner.core.impl.score.stream.drools.common.DroolsCondition<DroolsUniRuleStructure<A>>
  - - org.optaplanner.core.impl.score.stream.drools.uni.DroolsUniCondition<A>

-     public final class DroolsUniCondition<A>
      extends DroolsCondition<DroolsUniRuleStructure<A>>

- - ### Field Summary

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

      `ruleStructure`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `DroolsUniCondition(Class<A> aVariableType, LongSupplier variableIdSupplier)`
    `DroolsUniCondition(DroolsUniRuleStructure<A> ruleStructure)`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `<NewA,ResultContainer> DroolsUniCondition<NewA>` | `andCollect(UniConstraintCollector<A,ResultContainer,NewA> collector)`
    `DroolsUniCondition<A>` | `andFilter(Predicate<A> predicate)`
    `<NewA> DroolsUniCondition<NewA>` | `andGroup(Function<A,NewA> groupKeyMapping)`
    `<ResultContainer,NewA,NewB> DroolsBiCondition<NewA,NewB>` | `andGroupWithCollect(Function<A,NewA> groupKeyMapping, UniConstraintCollector<A,ResultContainer,NewB> collector)` The goal of this method is to create the left-hand side of a rule to look like this: when set(size > 0): accumulate(Person(), $set: Pair.of(Person::getCity, ConstraintCollectors.count())) Pair($newA: left, $newB: right) from $set then ...
    `<B> DroolsBiCondition<A,B>` | `andJoin(DroolsUniCondition<B> bCondition, AbstractBiJoiner<A,B> biJoiner)`
    `List<org.drools.model.RuleItemBuilder<?>>` | `completeWithScoring(org.drools.model.Global<? extends AbstractScoreHolder<?>> scoreHolderGlobal)`
    `List<org.drools.model.RuleItemBuilder<?>>` | `completeWithScoring(org.drools.model.Global<? extends AbstractScoreHolder<?>> scoreHolderGlobal, Function<A,BigDecimal> matchWeighter)`
    `List<org.drools.model.RuleItemBuilder<?>>` | `completeWithScoring(org.drools.model.Global<? extends AbstractScoreHolder<?>> scoreHolderGlobal, ToIntFunction<A> matchWeighter)`
    `List<org.drools.model.RuleItemBuilder<?>>` | `completeWithScoring(org.drools.model.Global<? extends AbstractScoreHolder<?>> scoreHolderGlobal, ToLongFunction<A> matchWeighter)`
    `static org.drools.model.Index.ConstraintType` | `getConstraintType(JoinerType type)`

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

      `getRuleStructure, impactScore, impactScore, impactScore, impactScore`

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

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

- - ### Constructor Detail

    - #### DroolsUniCondition

          public DroolsUniCondition(Class<A> aVariableType,
                                    LongSupplier variableIdSupplier)

    - #### DroolsUniCondition

          public DroolsUniCondition(DroolsUniRuleStructure<A> ruleStructure)

  - ### Method Detail

    - #### getConstraintType

          public static org.drools.model.Index.ConstraintType getConstraintType(JoinerType type)

    - #### andFilter

          public DroolsUniCondition<A> andFilter(Predicate<A> predicate)

    - #### andCollect

          public <NewA,ResultContainer> DroolsUniCondition<NewA> andCollect(UniConstraintCollector<A,ResultContainer,NewA> collector)

    - #### andGroup

          public <NewA> DroolsUniCondition<NewA> andGroup(Function<A,NewA> groupKeyMapping)

    - #### andGroupWithCollect

          public <ResultContainer,NewA,NewB> DroolsBiCondition<NewA,NewB> andGroupWithCollect(Function<A,NewA> groupKeyMapping,
                                                                                              UniConstraintCollector<A,ResultContainer,NewB> collector)

      The goal of this method is to create the left-hand side of a rule to look like this:

           when
               set(size > 0): accumulate(Person(), $set: Pair.of(Person::getCity, ConstraintCollectors.count()))
               Pair($newA: left, $newB: right) from $set
           then
               ...
           end

      Note: This is pseudo-code and the actual Drools code will look slightly different in terms of syntax.

      Type Parameters:
        `ResultContainer` - implementation detail, unimportant
        `NewA` - type of the first logical fact
        `NewB` - type of the second logical fact
      Parameters:
        `groupKeyMapping` - never null, grouping to apply
        `collector` - never null, collector to apply
      Returns:

    - #### andJoin

          public <B> DroolsBiCondition<A,B> andJoin(DroolsUniCondition<B> bCondition,
                                                    AbstractBiJoiner<A,B> biJoiner)

    - #### completeWithScoring

          public List<org.drools.model.RuleItemBuilder<?>> completeWithScoring(org.drools.model.Global<? extends AbstractScoreHolder<?>> scoreHolderGlobal)

    - #### completeWithScoring

          public List<org.drools.model.RuleItemBuilder<?>> completeWithScoring(org.drools.model.Global<? extends AbstractScoreHolder<?>> scoreHolderGlobal,
                                                                               ToIntFunction<A> matchWeighter)

    - #### completeWithScoring

          public List<org.drools.model.RuleItemBuilder<?>> completeWithScoring(org.drools.model.Global<? extends AbstractScoreHolder<?>> scoreHolderGlobal,
                                                                               ToLongFunction<A> matchWeighter)

    - #### completeWithScoring

          public List<org.drools.model.RuleItemBuilder<?>> completeWithScoring(org.drools.model.Global<? extends AbstractScoreHolder<?>> scoreHolderGlobal,
                                                                               Function<A,BigDecimal> matchWeighter)

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