|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.drools.rule.Rule
A set of Condition
s and a Consequence
.
The Conditions
describe the circumstances
that represent a match for this rule. The Consequence
gets fired when the Conditions
match.
Condition
,
Consequence
Constructor Summary | |
Rule(java.lang.String name)
Construct. |
Method Summary | |
void |
addCondition(Condition condition)
Add a Condition to this rule. |
void |
addDeclaration(Declaration declaration)
Add a declaration. |
void |
addExtraction(Extraction extraction)
Add a consistent Extraction to this rule. |
void |
addParameterDeclaration(Declaration declaration)
Add a root fact object parameter Declaration
for this Rule . |
void |
checkValidity()
Check the validity of this rule, and throw exceptions if it failed validity tests. |
java.util.Set |
getConditions()
Retrieve the Set of Conditions for
this rule. |
Consequence |
getConsequence()
Retrieve the Consequence associated with this Rule . |
Declaration |
getDeclaration(java.lang.String identifier)
Retrieve a Declaration by identifier. |
Declaration[] |
getDeclarationsArray()
Retrieve the array of all Declaration s of
this rule. |
long |
getDuration(Tuple tuple)
Retrieve the truthness duration. |
java.util.Set |
getExtractions()
Retrieve the Set of Extractions for
this rule. |
java.util.Set |
getLocalDeclarations()
Retrieve the set of all implied local Declarations. |
java.lang.String |
getName()
Retrieve the name of this rule. |
Declaration |
getParameterDeclaration(java.lang.String identifier)
Retrieve a parameter Declaration by identifier. |
java.util.Set |
getParameterDeclarations()
Retrieve the set of all root fact object parameter Declarations . |
boolean |
isValid()
Determine if this rule is internally consistent and valid. |
void |
setConsequence(Consequence consequence)
Set the Consequence that is associated with the
successful match of this rule. |
void |
setDuration(Duration duration)
Set the truthness duration. |
void |
setDuration(long seconds)
Set the truthness duration. |
java.lang.String |
toString()
Produce a debug string. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public Rule(java.lang.String name)
name
- The name of this rule.Method Detail |
public void setDuration(long seconds)
seconds
- The number of seconds the rule
must hold true in order to fire.public void setDuration(Duration duration)
duration
- The truth duration.public long getDuration(Tuple tuple)
tuple
- The tuple.public boolean isValid()
true
if this rule is valid, else false
.public void checkValidity() throws InvalidRuleException
Possibly exceptions include:
NoParameterDeclarationException
A Rule
must include at least one
parameter declaration and one condition.
InvalidRuleException
- if this rule is in any way invalid.public java.lang.String getName()
public void addParameterDeclaration(Declaration declaration)
Declaration
for this Rule
.declaration
- The root fact object Declaration
to add.public void addDeclaration(Declaration declaration)
declaration
- The declaration.public Declaration getParameterDeclaration(java.lang.String identifier)
Declaration
by identifier.identifier
- The identifier.null
if no
declaration matches the identifier
.public Declaration getDeclaration(java.lang.String identifier)
Declaration
by identifier.identifier
- The identifier.null
if no
declaration matches the identifier
.public java.util.Set getParameterDeclarations()
Declarations
.Set
of Declarations
which
specify the root fact objects.public java.util.Set getLocalDeclarations()
Set
of all implied Declarations
which are implied by the conditions.public Declaration[] getDeclarationsArray()
Declaration
s of
this rule.public void addCondition(Condition condition)
Condition
to this rule.condition
- The Condition
to add.public void addExtraction(Extraction extraction)
Extraction
to this rule.extraction
- the Extraction
to add.public java.util.Set getConditions()
Set
of Conditions
for
this rule.Set
of Conditions
.public java.util.Set getExtractions()
Set
of Extractions
for
this rule.Set
of Extractions
.public void setConsequence(Consequence consequence)
Consequence
that is associated with the
successful match of this rule.consequence
- The Consequence
to attach to this Rule
.public Consequence getConsequence()
Consequence
associated with this Rule
.Consequence
.public java.lang.String toString()
toString
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |