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

## Class DroolsUniCondition<A>

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

-     public final class DroolsUniCondition<A>
      extends Object

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `DroolsUniCondition(Class<A> aVariableType)`
    `DroolsUniCondition(org.drools.model.Declaration<DroolsLogicalTuple> aVariableDeclaration, Function<org.drools.model.Declaration<DroolsLogicalTuple>,org.drools.model.PatternDSL.PatternDef<DroolsLogicalTuple>> patternProvider)`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `DroolsUniCondition<A>` | `andFilter(Predicate<A> predicate)`
    `<B> DroolsBiCondition<A,B>` | `andJoin(DroolsUniCondition<B> bCondition, AbstractBiJoiner<A,B> biJoiner)`
    `<GroupKey_> List<org.drools.model.RuleItemBuilder<?>>` | `completeWithLogicalInsert(Object ruleId, Function<A,GroupKey_> groupKeyMapping)`
    `<ResultContainer,NewA,NewB> List<org.drools.model.RuleItemBuilder<?>>` | `completeWithLogicalInsert(Object ruleId, 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 accumulate(Person(), $set: collectSet(Person::getCity)) $newA : City() from $set // grouping accumulate(Person(getCity() == $newA), $newB: collect(ConstraintCollectors.count())) then insertLogical($newA, $newB); end Note: This is pseudo-code and the actual Drools code will look slightly different in terms of syntax.
    `<ResultContainer,NewA> List<org.drools.model.RuleItemBuilder<?>>` | `completeWithLogicalInsert(Object ruleId, UniConstraintCollector<A,ResultContainer,NewA> collector)`
    `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)`
    `DroolsMetadata<Object,A>` | `getAMetadata()`
    `static org.drools.model.Index.ConstraintType` | `getConstraintType(JoinerType type)`

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

    - #### DroolsUniCondition

          public DroolsUniCondition(org.drools.model.Declaration<DroolsLogicalTuple> aVariableDeclaration,
                                    Function<org.drools.model.Declaration<DroolsLogicalTuple>,org.drools.model.PatternDSL.PatternDef<DroolsLogicalTuple>> patternProvider)

  - ### Method Detail

    - #### getAMetadata

          public DroolsMetadata<Object,A> getAMetadata()

    - #### andFilter

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

    - #### andJoin

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

    - #### completeWithLogicalInsert

          public <ResultContainer,NewA,NewB> List<org.drools.model.RuleItemBuilder<?>> completeWithLogicalInsert(Object ruleId,
                                                                                                                 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
               accumulate(Person(), $set: collectSet(Person::getCity))
               $newA : City() from $set // grouping
               accumulate(Person(getCity() == $newA), $newB: collect(ConstraintCollectors.count()))
           then
               insertLogical($newA, $newB);
           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:
        `ruleId` - never null, id of the context in which the new facts will be inserted
        `groupKeyMapping` - never null, grouping to apply
        `collector` - never null, collector to apply
      Returns:

    - #### completeWithLogicalInsert

          public <ResultContainer,NewA> List<org.drools.model.RuleItemBuilder<?>> completeWithLogicalInsert(Object ruleId,
                                                                                                            UniConstraintCollector<A,ResultContainer,NewA> collector)

    - #### completeWithLogicalInsert

          public <GroupKey_> List<org.drools.model.RuleItemBuilder<?>> completeWithLogicalInsert(Object ruleId,
                                                                                                 Function<A,GroupKey_> groupKeyMapping)

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

    - #### getConstraintType

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

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