|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.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
,
Serialized Form
![]() |
![]() |
![]() |
![]() |
Constructor Summary | |
Rule(java.lang.String name)
Construct. |
|
Rule(java.lang.String name,
RuleSet ruleSet)
Construct. |
Method Summary | |
void |
addCondition(Condition condition)
Add a Condition to this rule. |
Declaration |
addParameterDeclaration(java.lang.String identifier,
ObjectType objectType)
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. |
java.lang.String |
dump(java.lang.String indent)
|
java.util.Map |
getApplicationData()
|
java.util.List |
getConditions()
Retrieve the List of Conditions for this
rule. |
int |
getConditionSize()
|
Consequence |
getConsequence()
Retrieve the Consequence associated with this
Rule . |
java.lang.String |
getDocumentation()
Retrieve the documentation. |
Duration |
getDuration()
Retrieve the truthness duration object. |
java.util.Set |
getImports(java.lang.Class clazz)
|
long |
getLoadOrder()
|
java.lang.String |
getName()
Retrieve the name of this rule. |
boolean |
getNoLoop()
|
Declaration |
getParameterDeclaration(java.lang.String identifier)
Retrieve a parameter Declaration by identifier. |
java.util.List |
getParameterDeclarations()
Retrieve the set of all root fact object parameter Declarations . |
RuleSet |
getRuleSet()
|
int |
getSalience()
Retrieve the Rule salience. |
boolean |
isValid()
Determine if this rule is internally consistent and valid. |
void |
setApplicationData(java.util.Map applicationData)
|
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 |
setImports(java.util.Set imports)
|
void |
setNoLoop(boolean noLoop)
|
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 |
Constructor Detail |
public Rule(java.lang.String name, RuleSet ruleSet)
name
- The name of this rule.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
Rule.setDuration(Duration)
with a FixedDuration
.
seconds
- The number of seconds the rule must hold true in order to
fire.Rule.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 RuleSet getRuleSet()
public java.lang.String getName()
public int getSalience()
Rule
salience.
public void setSalience(int salience)
Rule salience.
- Parameters:
salience
- The salience.
public boolean getNoLoop()
public void setNoLoop(boolean noLoop)
public Declaration addParameterDeclaration(java.lang.String identifier, ObjectType objectType) throws InvalidRuleException
Declaration
for
this Rule
.
InvalidRuleException
identifier
- The identifier.objectType
- The type.
public Declaration getParameterDeclaration(java.lang.String identifier)
Declaration
by identifier.
identifier
- The identifier.
null
if no declaration matches
the identifier
.public java.util.List getParameterDeclarations()
Declarations
.
Declarations
in order which specify the root fact objects.public void addCondition(Condition condition)
Condition
to this rule.
condition
- The Condition
to add.public java.util.List getConditions()
List
of Conditions
for this
rule.
List
of Conditions
.public int getConditionSize()
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 long getLoadOrder()
public void setImports(java.util.Set imports)
public java.util.Set getImports(java.lang.Class clazz)
public void setApplicationData(java.util.Map applicationData)
public java.util.Map getApplicationData()
public java.lang.String dump(java.lang.String indent)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |