|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.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(String name)
|
|
Rule(String name,
String agendaGroup)
Construct a Rule |
|
Rule(String name,
String pkg,
String agendaGroup)
Construct a Rule |
Method Summary | |
---|---|
void |
addPattern(RuleConditionElement element)
Add a pattern to the rule. |
boolean |
equals(Object object)
|
String |
getActivationGroup()
|
String |
getAgendaGroup()
|
boolean |
getAutoFocus()
|
Consequence |
getConsequence()
Retrieve the Consequence associated with this
Rule . |
Declaration |
getDeclaration(String identifier)
Retrieve a parameter Declaration by identifier. |
Declaration[] |
getDeclarations()
Retrieve the set of all root fact object parameter Declarations . |
String |
getDialect()
|
Duration |
getDuration()
Retrieve the truthness duration object. |
GroupElement |
getLhs()
Retrieve the List of Conditions for this
rule. |
long |
getLoadOrder()
|
String |
getName()
Retrieve the name of this rule. |
boolean |
getNoLoop()
|
String |
getPackage()
|
String |
getRuleFlowGroup()
|
int |
getSalience()
Retrieve the Rule salience. |
int |
getSpecifity()
|
GroupElement[] |
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 |
hasLogicalDependency()
|
boolean |
isEffective()
This returns true is the rule is effective. |
boolean |
isLockOnActive()
|
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 |
setActivationGroup(String activationGroup)
|
void |
setAgendaGroup(String agendaGroup)
|
void |
setAutoFocus(boolean autoFocus)
|
void |
setConsequence(Consequence consequence)
Set the Consequence that is associated with the successful
match of this rule. |
void |
setDateEffective(Calendar effectiveDate)
Sets the date from which this rule takes effect (can include time to the millisecond). |
void |
setDateExpires(Calendar expiresDate)
Sets the date after which the rule will no longer apply (can include time to the millisecond). |
void |
setDialect(String dialect)
|
void |
setDuration(Duration duration)
Set the truthness duration object. |
void |
setDuration(long ms)
Set the truthness duration. |
void |
setEnabled(boolean b)
A rule is enabled by default. |
void |
setHasLogicalDependency(boolean hasLogicalDependency)
|
void |
setLhs(GroupElement lhsRoot)
|
void |
setLockOnActive(boolean lockOnActive)
|
void |
setNoLoop(boolean noLoop)
|
void |
setRuleFlowGroup(String ruleFlowGroup)
|
void |
setSalience(int salience)
Set the Rule |
void |
setSemanticallyValid(boolean valid)
|
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Rule(String name, String pkg, String agendaGroup)
Rule with the given name for the specified pkg parent
- Parameters:
name
- The name of this rule.
public Rule(String name, String agendaGroup)
Rule with the given name for the specified pkg parent
- Parameters:
name
- The name of this rule.
public Rule(String name)
Method Detail |
---|
public String getDialect()
public void setDialect(String dialect)
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 String getPackage()
public String getName()
public int getSalience()
Rule
salience.
public void setSalience(int salience)
Rule salience.
- Parameters:
salience
- The salience.
public String getAgendaGroup()
public void setAgendaGroup(String agendaGroup)
public boolean getNoLoop()
public boolean isEffective()
public void setNoLoop(boolean noLoop)
public boolean getAutoFocus()
public void setAutoFocus(boolean autoFocus)
public String getActivationGroup()
public void setActivationGroup(String activationGroup)
public String getRuleFlowGroup()
public void setRuleFlowGroup(String ruleFlowGroup)
public Declaration getDeclaration(String identifier)
Declaration
by identifier.
identifier
- The identifier.
null
if no declaration matches
the identifier
.public boolean hasLogicalDependency()
public void setHasLogicalDependency(boolean hasLogicalDependency)
public boolean isLockOnActive()
public void setLockOnActive(boolean lockOnActive)
public Declaration[] getDeclarations()
Declarations
.
Declarations
in order which specify the
root fact objects.public void addPattern(RuleConditionElement element)
condition
- The Test
to add.
InvalidRuleException
public GroupElement getLhs()
List
of Conditions
for this
rule.
List
of Conditions
.public void setLhs(GroupElement lhsRoot)
public GroupElement[] 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 String toString()
public boolean equals(Object object)
public int hashCode()
public void setSemanticallyValid(boolean valid)
public boolean isSemanticallyValid()
public void setDateEffective(Calendar effectiveDate)
effectiveDate
- public void setDateExpires(Calendar expiresDate)
expiresDate
- public void setEnabled(boolean b)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |