|
||||||||||
| 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 Tests and a
Consequence.
The Tests describe the circumstances that representrepresent
a match for this rule. The Consequence gets fired when the
Conditions match.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from interface org.drools.definition.KnowledgeDefinition |
|---|
org.drools.definition.KnowledgeDefinition.KnowledgeType |
| Field Summary | |
|---|---|
protected String |
activationListener
|
static String |
DEFAULT_CONSEQUENCE_NAME
|
| Constructor Summary | |
|---|---|
Rule()
|
|
Rule(String name)
|
|
Rule(String name,
String agendaGroup)
Construct a Rule |
|
Rule(String name,
String pkg,
String agendaGroup)
Construct a Rule |
|
| Method Summary | |
|---|---|
void |
addMetaAttribute(String key,
Object value)
|
void |
addNamedConsequence(String name,
Consequence consequence)
|
void |
addPattern(RuleConditionElement element)
Add a pattern to the rule. |
boolean |
equals(Object obj)
|
String |
getActivationGroup()
|
String |
getActivationListener()
|
String |
getAgendaGroup()
|
boolean |
getAutoFocus()
|
String[] |
getCalendars()
|
Consequence |
getConsequence()
Retrieve the Consequence associated with this
Rule. |
ConsequenceMetaData |
getConsequenceMetaData()
|
Calendar |
getDateEffective()
|
Calendar |
getDateExpires()
|
Declaration |
getDeclaration(String identifier)
Retrieve a parameter Declaration by identifier. |
Map<String,Declaration> |
getDeclarations()
Retrieve the set of all root fact object parameter Declarations. |
String |
getDialect()
|
Enabled |
getEnabled()
|
String |
getId()
|
org.drools.definition.KnowledgeDefinition.KnowledgeType |
getKnowledgeType()
|
GroupElement |
getLhs()
Retrieve the List of Conditions for this
rule. |
long |
getLoadOrder()
|
String |
getMetaAttribute(String identifier)
Deprecated. |
Map<String,Object> |
getMetaAttributes()
Deprecated. |
Map<String,Object> |
getMetaData()
|
static List |
getMethodBytecode(Class cls,
String ruleClassName,
String packageName,
String methodName,
String resource)
|
String |
getName()
Retrieve the name of this rule. |
Consequence |
getNamedConsequence(String consequenceName)
|
Map<String,Consequence> |
getNamedConsequences()
|
String |
getNamespace()
|
String |
getPackage()
|
String |
getPackageName()
|
Rule |
getParent()
|
String[] |
getRequiredDeclarationsForConsequence(String consequenceName)
|
org.drools.io.Resource |
getResource()
|
String |
getRuleFlowGroup()
|
int |
getRunLevel()
|
Salience |
getSalience()
Retrieve the Rule salience. |
int |
getSpecifity()
|
Timer |
getTimer()
Returns the Timer semantics for a rule. |
GroupElement[] |
getTransformedLhs(LogicTransformer transformer)
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()
This field is updated at runtime, when the first logical assertion is done. |
boolean |
hasNamedConsequences()
|
boolean |
isEffective(Tuple tuple,
RuleTerminalNode rtn,
WorkingMemory workingMemory)
This returns true is the rule is effective. |
boolean |
isEnabled(Tuple tuple,
RuleTerminalNode rtn,
WorkingMemory workingMemory)
|
boolean |
isLockOnActive()
|
boolean |
isNoLoop()
|
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. |
Collection<String> |
listMetaAttributes()
Deprecated. |
void |
readExternal(ObjectInput in)
|
void |
setActivationGroup(String activationGroup)
|
void |
setActivationListener(String activationListener)
|
void |
setAgendaGroup(String agendaGroup)
|
void |
setAutoFocus(boolean autoFocus)
|
void |
setCalendars(String[] calendars)
|
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 |
setEnabled(Enabled b)
A rule is enabled by default. |
void |
setHasLogicalDependency(boolean hasLogicalDependency)
|
void |
setLhs(GroupElement lhsRoot)
|
void |
setLoadOrder(long loadOrder)
|
void |
setLockOnActive(boolean lockOnActive)
|
void |
setNoLoop(boolean noLoop)
|
void |
setPackage(String pkg)
|
void |
setParent(Rule parent)
|
void |
setRequiredDeclarationsForConsequence(String consequenceName,
String[] requiredDeclarations)
|
void |
setResource(org.drools.io.Resource resource)
|
void |
setRuleFlowGroup(String ruleFlowGroup)
|
void |
setRunLevel(int level)
|
void |
setSalience(Salience salience)
Set the Rule |
void |
setSemanticallyValid(boolean valid)
|
void |
setTimer(Timer timer)
Sets the timer semantics for a rule. |
String |
toString()
|
void |
wire(Object object)
|
void |
writeExternal(ObjectOutput out)
|
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final String DEFAULT_CONSEQUENCE_NAME
protected String activationListener
| Constructor Detail |
|---|
public Rule()
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 void writeExternal(ObjectOutput out)
throws IOException
writeExternal in interface ExternalizableIOException
public void readExternal(ObjectInput in)
throws IOException,
ClassNotFoundException
readExternal in interface ExternalizableIOException
ClassNotFoundExceptionpublic org.drools.io.Resource getResource()
public void setResource(org.drools.io.Resource resource)
public String getDialect()
getDialect in interface Dialectablepublic void setDialect(String dialect)
public Timer getTimer()
public void setTimer(Timer timer)
timer - 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 void setPackage(String pkg)
public String getPackageName()
getPackageName in interface org.drools.definition.rule.QuerygetPackageName in interface org.drools.definition.rule.Rulepublic String getName()
getName in interface org.drools.definition.rule.QuerygetName in interface org.drools.definition.rule.Rulepublic Salience getSalience()
Rule salience.
public void setSalience(Salience salience)
Rule salience.
- Parameters:
salience - The salience.
public int getRunLevel()
public void setRunLevel(int level)
public String getAgendaGroup()
public void setAgendaGroup(String agendaGroup)
public boolean isNoLoop()
public boolean isEffective(Tuple tuple,
RuleTerminalNode rtn,
WorkingMemory workingMemory)
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 String[] getRequiredDeclarationsForConsequence(String consequenceName)
public void setRequiredDeclarationsForConsequence(String consequenceName,
String[] requiredDeclarations)
public boolean hasLogicalDependency()
public void setHasLogicalDependency(boolean hasLogicalDependency)
public boolean isLockOnActive()
public void setLockOnActive(boolean lockOnActive)
public Map<String,Declaration> getDeclarations()
Declarations.
Declarations in order which specify the
root fact objects.public void addPattern(RuleConditionElement element)
element - The Test to add.
InvalidRuleExceptionpublic GroupElement getLhs()
List of Conditions for this
rule.
List of Conditions.public void setLhs(GroupElement lhsRoot)
public GroupElement[] getTransformedLhs(LogicTransformer transformer)
throws InvalidPatternException
InvalidPatternExceptionpublic int getSpecifity()
public void wire(Object object)
wire in interface Wireablepublic 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 boolean hasNamedConsequences()
public Map<String,Consequence> getNamedConsequences()
public Consequence getNamedConsequence(String consequenceName)
public void addNamedConsequence(String name,
Consequence consequence)
public long getLoadOrder()
public void setLoadOrder(long loadOrder)
public String toString()
toString in class Objectpublic int hashCode()
hashCode in class Objectpublic boolean equals(Object obj)
equals in class Objectpublic void setSemanticallyValid(boolean valid)
public boolean isSemanticallyValid()
public String[] getCalendars()
public void setCalendars(String[] calendars)
public void setDateEffective(Calendar effectiveDate)
effectiveDate - public void setDateExpires(Calendar expiresDate)
expiresDate - public Calendar getDateEffective()
public Calendar getDateExpires()
public void setEnabled(Enabled b)
public Enabled getEnabled()
public boolean isEnabled(Tuple tuple,
RuleTerminalNode rtn,
WorkingMemory workingMemory)
public void addMetaAttribute(String key,
Object value)
public String getActivationListener()
public void setActivationListener(String activationListener)
public Map<String,Object> getMetaData()
getMetaData in interface org.drools.definition.rule.QuerygetMetaData in interface org.drools.definition.rule.Rule@Deprecated public Map<String,Object> getMetaAttributes()
getMetaAttributes in interface org.drools.definition.rule.QuerygetMetaAttributes in interface org.drools.definition.rule.Rule@Deprecated public String getMetaAttribute(String identifier)
getMetaAttribute in interface org.drools.definition.rule.QuerygetMetaAttribute in interface org.drools.definition.rule.Rule@Deprecated public Collection<String> listMetaAttributes()
listMetaAttributes in interface org.drools.definition.rule.QuerylistMetaAttributes in interface org.drools.definition.rule.Rulepublic void setParent(Rule parent)
public Rule getParent()
public static List getMethodBytecode(Class cls,
String ruleClassName,
String packageName,
String methodName,
String resource)
public org.drools.definition.KnowledgeDefinition.KnowledgeType getKnowledgeType()
getKnowledgeType in interface org.drools.definition.KnowledgeDefinitionpublic String getNamespace()
getNamespace in interface org.drools.definition.KnowledgeDefinitionpublic String getId()
getId in interface org.drools.definition.KnowledgeDefinitionpublic ConsequenceMetaData getConsequenceMetaData()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||