|
|||||||||
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 Test
s and a
Consequence
.
The Test
s describe the circumstances that representrepresent
a match for this rule. The Consequence
gets fired when the
Conditions match.
Eval
,
Consequence
,
Serialized FormConstructor Summary | |
---|---|
Rule(java.lang.String name)
|
|
Rule(java.lang.String name,
java.lang.String agendaGroup)
Construct a Rule |
|
Rule(java.lang.String name,
java.lang.String pkg,
java.lang.String agendaGroup)
Construct a Rule |
Method Summary | |
---|---|
void |
addPattern(Column column)
|
void |
addPattern(ConditionalElement ce)
Add a pattern to the rule. |
boolean |
equals(java.lang.Object object)
|
java.lang.String |
getActivationGroup()
|
java.lang.String |
getAgendaGroup()
|
boolean |
getAutoFocus()
|
Consequence |
getConsequence()
Retrieve the Consequence associated with this
Rule . |
Declaration |
getDeclaration(java.lang.String identifier)
Retrieve a parameter Declaration by identifier. |
Declaration[] |
getDeclarations()
Retrieve the set of all root fact object parameter Declarations . |
Duration |
getDuration()
Retrieve the truthness duration object. |
And |
getLhs()
Retrieve the List of Conditions for this
rule. |
long |
getLoadOrder()
|
java.lang.String |
getName()
Retrieve the name of this rule. |
boolean |
getNoLoop()
|
java.lang.String |
getPackage()
|
int |
getSalience()
Retrieve the Rule salience. |
int |
getSpecifity()
|
And[] |
getTransformedLhs()
Uses the LogicTransformer to process the Rule patters - if no ORs are used this will return an array of a single AND element. |
int |
hashCode()
|
boolean |
isSemanticallyValid()
This will return if the semantic actions or predicates in the rules are valid. |
boolean |
isValid()
Determine if this rule is internally consistent and valid. |
void |
setAgendaGroup(java.lang.String agendaGroup)
|
void |
setAutoFocus(boolean autoFocus)
|
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 object. |
void |
setDuration(long ms)
Set the truthness duration. |
void |
setNoLoop(boolean noLoop)
|
void |
setSalience(int salience)
Set the Rule |
void |
setSemanticallyValid(boolean valid)
|
void |
setXorGroup(java.lang.String activationGroup)
|
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Rule(java.lang.String name, java.lang.String pkg, java.lang.String agendaGroup)
Rule with the given name for the specified pkg parent
- Parameters:
name
- The name of this rule.
public Rule(java.lang.String name, java.lang.String agendaGroup)
Rule with the given name for the specified pkg parent
- Parameters:
name
- The name of this rule.
public Rule(java.lang.String name)
Method Detail |
---|
public void setDuration(long ms)
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 java.lang.String getPackage()
public java.lang.String getName()
public int getSalience()
Rule
salience.
public void setSalience(int salience)
Rule salience.
- Parameters:
salience
- The salience.
public java.lang.String getAgendaGroup()
public void setAgendaGroup(java.lang.String agendaGroup)
public boolean getNoLoop()
public void setNoLoop(boolean noLoop)
public boolean getAutoFocus()
public void setAutoFocus(boolean autoFocus)
public java.lang.String getActivationGroup()
public void setXorGroup(java.lang.String activationGroup)
public Declaration getDeclaration(java.lang.String identifier)
Declaration
by identifier.
identifier
- The identifier.
null
if no declaration matches
the identifier
.public Declaration[] getDeclarations()
Declarations
.
Declarations
in order which specify the
root fact objects.public void addPattern(ConditionalElement ce)
condition
- The Test
to add.
InvalidRuleException
public void addPattern(Column column)
public And getLhs()
List
of Conditions
for this
rule.
List
of Conditions
.public And[] getTransformedLhs() throws InvalidPatternException
InvalidPatternException
public int getSpecifity()
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 toString()
toString
in class java.lang.Object
public boolean equals(java.lang.Object object)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public void setSemanticallyValid(boolean valid)
public boolean isSemanticallyValid()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |