|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.drools.rule.Rule
public class Rule
A Rule
contains a set of Condition
s and a
Consequence
.
The Condition
s describe the circumstances that
representrepresent a match for this rule. The Consequence
gets
fired when the Conditions match.
Condition
,
Consequence
,
Serialized FormConstructor Summary | |
---|---|
Rule(java.lang.String name)
Construct a Rule for the given name with null for the
parent RuleSet
Rule s will nearly always
want to be in a RuleSet. |
|
Rule(java.lang.String name,
RuleSet ruleSet)
Construct a Rule |
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. |
Importer |
getImporter()
|
long |
getLoadOrder()
|
java.lang.String |
getName()
Retrieve the name of this rule. |
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. |
java.lang.String |
getXorGroup()
|
boolean |
isNoLoop()
|
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 |
setImporter(Importer importer)
|
void |
setNoLoop(boolean noLoop)
|
void |
setSalience(int salience)
Set the Rule |
void |
setXorGroup(java.lang.String xorGroup)
|
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)
Rule with the given name for the specified ruleSet parent
- Parameters:
name
- The name of this rule.
public Rule(java.lang.String name)
Rule
for the given name with null for the
parent RuleSet
Rule
s will nearly always
want to be in a RuleSet. This is more of a convenience constructor for
the times you dont, ie during unit testing.
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)
Consequence
if the rule is still true at the end of the
duration.
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)
Consequence
if the rule is still true at the end of the
duration.
duration
- The truth duration object.public Duration getDuration()
public boolean isValid()
A Rule
must include at least one parameter declaration and
one condition.
true
if this rule is valid, else
false
.public void checkValidity() throws InvalidRuleException
Possibly exceptions include:
NoParameterDeclarationException NoConsequenceException
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 isNoLoop()
public void setNoLoop(boolean noLoop)
public Declaration addParameterDeclaration(java.lang.String identifier, ObjectType objectType) throws InvalidRuleException
Declaration
for
this Rule
.
identifier
- The identifier.objectType
- The type.
InvalidRuleException
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 java.lang.String getXorGroup()
public void setXorGroup(java.lang.String xorGroup)
public Importer getImporter()
public void setImporter(Importer importer)
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 |