|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | 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
Field Summary | |
static Rule[] |
EMPTY_ARRAY
Empty Rule array. |
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 fails validity tests. |
Declaration[] |
getAllDeclarations()
Retrieve the array of all Declaration s of
this rule. |
Condition[] |
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. |
java.lang.String |
getDocumentation()
Retrieve the documentation. |
Duration |
getDuration()
Retrieve the truthness duration object. |
Extraction[] |
getExtractions()
Retrieve the Set of Extractions for
this rule. |
Declaration[] |
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. |
Declaration[] |
getParameterDeclarations()
Retrieve the set of all root fact object parameter Declarations . |
int |
getSalience()
Retrieve the Rule salience. |
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 |
setDocumentation(java.lang.String documentation)
Set the documentation. |
void |
setDuration(Duration duration)
Set the truthness duration object. |
void |
setDuration(long seconds)
Set the truthness duration. |
void |
setSalience(int salience)
Set the Rule |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final Rule[] EMPTY_ARRAY
Rule
array.
Constructor Detail |
public Rule(java.lang.String name)
name
- The name of this rule.Method Detail |
public void setDocumentation(java.lang.String documentation)
documentation
- The documentation.public java.lang.String getDocumentation()
null
if none.public void setDuration(long seconds)
This is merely a convenience method for calling
setDuration(Duration)
with a FixedDuration
.
seconds
- The number of seconds the rule
must hold true in order to fire.setDuration(Duration)
,
FixedDuration
public void setDuration(Duration duration)
duration
- The truth duration object.public Duration getDuration()
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 int getSalience()
Rule
salience.
public void setSalience(int salience)
Rule salience.
- Parameters:
salience
- The salience.
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 Declaration[] getParameterDeclarations()
Declarations
.
Set
of Declarations
which
specify the root fact objects.public Declaration[] getLocalDeclarations()
Set
of all implied Declarations
which are implied by the conditions.public Declaration[] getAllDeclarations()
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 Condition[] getConditions()
Set
of Conditions
for
this rule.
Set
of Conditions
.public Extraction[] 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
.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |