public abstract class DroolsRuleStructure extends Object
Modifier | Constructor and Description |
---|---|
protected |
DroolsRuleStructure(LongSupplier variableIdSupplier) |
Modifier and Type | Method and Description |
---|---|
<X> org.drools.model.Variable<? extends X> |
createVariable(Class<X> clz,
String name)
Declare a new
Variable in this rule, with a given name and no declared source. |
<X> org.drools.model.Variable<? extends X> |
createVariable(Class<X> clz,
String name,
org.drools.model.DeclarationSource source)
Declare a new
Variable in this rule, with a given name and a declaration source. |
<X> org.drools.model.Variable<X> |
createVariable(String name)
Declares a new
Object -typed variable, see createVariable(Class, String, DeclarationSource) for
details. |
<X> org.drools.model.Variable<X> |
createVariable(String name,
org.drools.model.DeclarationSource source)
Declares a new
Object -typed variable, see createVariable(Class, String) for
details. |
List<org.drools.model.RuleItemBuilder<?>> |
finish(org.drools.model.consequences.ConsequenceBuilder.AbstractValidBuilder<?> consequence) |
abstract List<org.drools.model.RuleItemBuilder<?>> |
getClosedRuleItems() |
abstract List<org.drools.model.RuleItemBuilder<?>> |
getOpenRuleItems()
Every other pattern necessary for the
getPrimaryPattern() to function properly within the Drools rule's
left-hand side. |
abstract DroolsPatternBuilder<Object> |
getPrimaryPattern()
Returns the pattern that the subsequent streams may further expand.
|
LongSupplier |
getVariableIdSupplier() |
<NewA> DroolsUniRuleStructure<NewA> |
recollect(org.drools.model.Variable<NewA> newA,
org.drools.model.view.ViewItem<?> accumulatePattern) |
<NewA> DroolsUniRuleStructure<NewA> |
regroup(org.drools.model.Variable<Set<NewA>> newASource,
org.drools.model.PatternDSL.PatternDef<Set<NewA>> collectPattern,
org.drools.model.view.ViewItem<?> accumulatePattern) |
<NewA,NewB> |
regroupBi(org.drools.model.Variable<Set<BiTuple<NewA,NewB>>> newSource,
org.drools.model.PatternDSL.PatternDef<Set<BiTuple<NewA,NewB>>> collectPattern,
org.drools.model.view.ViewItem<?> accumulatePattern) |
<NewA,NewB,NewC,NewD> |
regroupBiToQuad(org.drools.model.Variable<Set<QuadTuple<NewA,NewB,NewC,NewD>>> newSource,
org.drools.model.PatternDSL.PatternDef<Set<QuadTuple<NewA,NewB,NewC,NewD>>> collectPattern,
org.drools.model.view.ViewItem<?> accumulatePattern) |
<NewA,NewB,NewC> |
regroupBiToTri(org.drools.model.Variable<Set<TriTuple<NewA,NewB,NewC>>> newSource,
org.drools.model.PatternDSL.PatternDef<Set<TriTuple<NewA,NewB,NewC>>> collectPattern,
org.drools.model.view.ViewItem<?> accumulatePattern) |
protected DroolsRuleStructure(LongSupplier variableIdSupplier)
public final <X> org.drools.model.Variable<? extends X> createVariable(Class<X> clz, String name)
Variable
in this rule, with a given name and no declared source. Delegates to
DSL.declarationOf(Class, String)
.
Creating variables via this method guarantees unique variable name within the context of a rule through the use
of DroolsConstraintFactory.getVariableIdSupplier()
.X
- Generic type of the variable.clz
- type of the variable. Using Object
will work in all cases, but Drools will spend unnecessary
amount of time looking up applicable instances of that variable, as it has to traverse instances of all types in
the working memory. Therefore, it is desirable to be as specific as possible.name
- name of the variable, mostly useful for debugging purposes. Will be decorated by a pseudo-random
numeric identifier to prevent multiple variables of the same name to exist within left-hand side of a single
rule.public final <X> org.drools.model.Variable<? extends X> createVariable(Class<X> clz, String name, org.drools.model.DeclarationSource source)
Variable
in this rule, with a given name and a declaration source.
Delegates to DSL.declarationOf(Class, String, DeclarationSource)
.
Creating variables via this method guarantees unique variable names within the context of a rule through the use
of DroolsConstraintFactory.getVariableIdSupplier()
.X
- Generic type of the variable.clz
- type of the variable. Using Object
will work in all cases, but Drools will spend unnecessary
amount of time looking up applicable instances of that variable, as it has to traverse instances of all types in
the working memory. Therefore, it is desirable to be as specific as possible.name
- name of the variable, mostly useful for debugging purposes. Will be decorated by a pseudo-random
numeric identifier to prevent multiple variables of the same name to exist within left-hand side of a single
rule.source
- declaration source of the variablepublic final <X> org.drools.model.Variable<X> createVariable(String name)
Object
-typed variable, see createVariable(Class, String, DeclarationSource)
for
details.public final <X> org.drools.model.Variable<X> createVariable(String name, org.drools.model.DeclarationSource source)
Object
-typed variable, see createVariable(Class, String)
for
details.public final List<org.drools.model.RuleItemBuilder<?>> finish(org.drools.model.consequences.ConsequenceBuilder.AbstractValidBuilder<?> consequence)
public LongSupplier getVariableIdSupplier()
public abstract DroolsPatternBuilder<Object> getPrimaryPattern()
$a1: A() $a2: A(this != $a1)The primary pattern would be the latter one ($a2), as that is the pattern you would use to further expand your output in both $a1 and $a2.
public abstract List<org.drools.model.RuleItemBuilder<?>> getOpenRuleItems()
getPrimaryPattern()
to function properly within the Drools rule's
left-hand side. In the example rule (see getPrimaryPattern()
, this method would return one and only
open RuleItemBuilder
, the one representing $a1.public abstract List<org.drools.model.RuleItemBuilder<?>> getClosedRuleItems()
public <NewA> DroolsUniRuleStructure<NewA> recollect(org.drools.model.Variable<NewA> newA, org.drools.model.view.ViewItem<?> accumulatePattern)
public <NewA> DroolsUniRuleStructure<NewA> regroup(org.drools.model.Variable<Set<NewA>> newASource, org.drools.model.PatternDSL.PatternDef<Set<NewA>> collectPattern, org.drools.model.view.ViewItem<?> accumulatePattern)
public <NewA,NewB> DroolsBiRuleStructure<NewA,NewB> regroupBi(org.drools.model.Variable<Set<BiTuple<NewA,NewB>>> newSource, org.drools.model.PatternDSL.PatternDef<Set<BiTuple<NewA,NewB>>> collectPattern, org.drools.model.view.ViewItem<?> accumulatePattern)
public <NewA,NewB,NewC> DroolsTriRuleStructure<NewA,NewB,NewC> regroupBiToTri(org.drools.model.Variable<Set<TriTuple<NewA,NewB,NewC>>> newSource, org.drools.model.PatternDSL.PatternDef<Set<TriTuple<NewA,NewB,NewC>>> collectPattern, org.drools.model.view.ViewItem<?> accumulatePattern)
public <NewA,NewB,NewC,NewD> DroolsQuadRuleStructure<NewA,NewB,NewC,NewD> regroupBiToQuad(org.drools.model.Variable<Set<QuadTuple<NewA,NewB,NewC,NewD>>> newSource, org.drools.model.PatternDSL.PatternDef<Set<QuadTuple<NewA,NewB,NewC,NewD>>> collectPattern, org.drools.model.view.ViewItem<?> accumulatePattern)
Copyright © 2006–2020 JBoss by Red Hat. All rights reserved.