|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.drools.reteoo.Builder
Builds the Rete-OO network for a RuleSet
.
RuleSet
Constructor Summary | |
Builder(Rete rete)
Construct a Builder against an existing
Rete network. |
Method Summary | |
void |
addRule(Rule rule)
Add a Rule to the network. |
protected void |
attachConditions(java.util.Set conds,
java.util.Set leafNodes)
Create and attach Condition s to the network. |
protected boolean |
attachExtractions(java.util.Set factExtracts,
java.util.Set leafNodes)
Create and attach Extraction s to the network. |
protected boolean |
canBeJoined(TupleSource left,
TupleSource right)
Determine if two TupleSource s can be joined. |
protected boolean |
createJoinNodes(java.util.Set leafNodes)
Create and attach JoinNode s to the network. |
protected java.util.Set |
createParameterNodes(Rule rule)
Create the ParameterNode s for the Rule ,
and link into the network. |
protected TupleSourceImpl |
findMatchingTupleSourceForCondition(Condition condition,
java.util.Set sources)
Locate a TupleSource suitable for attaching
the Condition . |
protected TupleSourceImpl |
findMatchingTupleSourceForExtraction(Extraction extract,
java.util.Set sources)
Locate a TupleSource suitable for attaching
the Extraction . |
Rete |
getRete()
Retrieve the Rete this Builder
appends to. |
protected boolean |
joinArbitrary(java.util.Set leafNodes)
Join two arbitrary leaves in order to satisfy a filter that currently cannot be applied. |
protected boolean |
joinForCondition(java.util.Set conds,
java.util.Set leafNodes)
Join two arbitrary leaves in order to satisfy a filter that currently cannot be applied. |
protected boolean |
matches(Condition condition,
java.util.Set declarations)
Determine if a set of Declarations match those
required by a Condition . |
protected boolean |
matches(Declaration[] requiredDecls,
java.util.Set declarations)
Determine if a set of Declarations is a super
set of required Declarations |
protected boolean |
matches(Extraction extract,
java.util.Set declarations)
Determine if a set of Declarations match those
required by a Extraction . |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public Builder(Rete rete)
Builder
against an existing
Rete
network.
rete
- The network to add to.Method Detail |
public Rete getRete()
Rete
this Builder
appends to.
Rete
.public void addRule(Rule rule) throws RuleIntegrationException
Rule
to the network.
rule
- The rule to add.
RuleIntegrationException
- if an error prevents complete
construction of the network for the Rule
.protected java.util.Set createParameterNodes(Rule rule)
ParameterNode
s for the Rule
,
and link into the network.
rule
- The rule.
Set
of ParameterNodes
created
and linked into the network.protected void attachConditions(java.util.Set conds, java.util.Set leafNodes)
Condition
s to the network.
It may not be possible to satisfy all filder conditions
on the first pass. This method removes satisfied conditions
from the Condition
parameter, and leaves
unsatisfied ones in the Set
.
conds
- Set of Conditions
to attempt attaching.leafNodes
- The current attachable leaf nodes
of the network.protected boolean joinForCondition(java.util.Set conds, java.util.Set leafNodes)
conds
- The filter conditions remaining.leafNodes
- Available leaf nodes.
true
if a join was possible,
otherwise, false
.protected boolean joinArbitrary(java.util.Set leafNodes)
leafNodes
- Available leaf nodes.protected boolean createJoinNodes(java.util.Set leafNodes)
JoinNode
s to the network.
It may not be possible to join all leafNodes
.
Any leafNodes
member that particiates
in a join is removed from the leafNodes
collection, and replaced by the joining JoinNode
.
leafNodes
- The current attachable leaf nodes of
the network.
true
if at least one JoinNode
was created, else false
.protected boolean canBeJoined(TupleSource left, TupleSource right)
TupleSource
s can be joined.
left
- The left tuple sourceright
- The right tuple source
true
if they can be joined (they share
at least one common member declaration), else
false
.protected boolean attachExtractions(java.util.Set factExtracts, java.util.Set leafNodes)
Extraction
s to the network.
It may not be possible to satisfy all Extraction
,
in which case, unsatisfied conditions will remain in the Set
passed in as Extraction
.
factExtracts
- Set of Extractions
to
attach to the network.leafNodes
- The current attachable leaf nodes of
the network.
true
if fact extractions have been
attached, otherwise false
.protected TupleSourceImpl findMatchingTupleSourceForCondition(Condition condition, java.util.Set sources)
TupleSource
suitable for attaching
the Condition
.
condition
- The Condition
to attach.sources
- Candidate TupleSources
.
TupleSource
if a suitable one
can be found, else null
.protected TupleSourceImpl findMatchingTupleSourceForExtraction(Extraction extract, java.util.Set sources)
TupleSource
suitable for attaching
the Extraction
.
extract
- The Extraction
to attach.sources
- Candidate TupleSources
.
TupleSource
if a suitable one
can be found, else null
.protected boolean matches(Condition condition, java.util.Set declarations)
Declarations
match those
required by a Condition
.
condition
- The Condition
.declarations
- The set of Declarations
to compare against.
true
if the set of Declarations
is a
super-set of the Declarations
required by the
Condition
.protected boolean matches(Extraction extract, java.util.Set declarations)
Declarations
match those
required by a Extraction
.
extract
- The Extraction
.declarations
- The set of Declarations
to compare against.
true
if the set of Declarations
is a
super-set of the Declarations
required by the
Condition
.protected boolean matches(Declaration[] requiredDecls, java.util.Set declarations)
Declarations
is a super
set of required Declarations
requiredDecls
- The required Declarations
.declarations
- The set of Declarations
to compare against.
true
if the set of Declarations
is a
super-set of the Declarations
required by the
Condition
.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |