|
||||||||||
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.
Field Summary | |
---|---|
protected String |
activationListener
|
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 |
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 . |
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()
|
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. |
Map<String,Consequence> |
getNamedConsequences()
|
String |
getPackage()
|
String |
getPackageName()
|
Rule |
getParent()
|
String[] |
getRequiredDeclarations()
|
org.drools.io.Resource |
getResource()
|
String |
getRuleFlowGroup()
|
Salience |
getSalience()
Retrieve the Rule salience. |
int |
getSpecifity()
|
Timer |
getTimer()
Returns the Timer semantics for a rule. |
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()
This field is updated at runtime, when the first logical assertion is done. |
boolean |
isEffective(Tuple tuple,
WorkingMemory workingMemory)
This returns true is the rule is effective. |
boolean |
isEnabled(Tuple tuple,
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 |
setRequiredDeclarations(String[] requiredDeclarations)
|
void |
setResource(org.drools.io.Resource resource)
|
void |
setRuleFlowGroup(String ruleFlowGroup)
|
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 |
---|
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 Externalizable
IOException
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
readExternal
in interface Externalizable
IOException
ClassNotFoundException
public org.drools.io.Resource getResource()
public void setResource(org.drools.io.Resource resource)
public String getDialect()
getDialect
in interface Dialectable
public 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.Query
getPackageName
in interface org.drools.definition.rule.Rule
public String getName()
getName
in interface org.drools.definition.rule.Query
getName
in interface org.drools.definition.rule.Rule
public Salience getSalience()
Rule
salience.
public void setSalience(Salience salience)
Rule salience.
- Parameters:
salience
- The salience.
public String getAgendaGroup()
public void setAgendaGroup(String agendaGroup)
public boolean isNoLoop()
public boolean isEffective(Tuple tuple, 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[] getRequiredDeclarations()
public void setRequiredDeclarations(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)
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 wire(Object object)
wire
in interface Wireable
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 Map<String,Consequence> getNamedConsequences()
public long getLoadOrder()
public void setLoadOrder(long loadOrder)
public String toString()
toString
in class Object
public int hashCode()
hashCode
in class Object
public boolean equals(Object obj)
equals
in class Object
public 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 boolean isEnabled(Tuple tuple, 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.Query
getMetaData
in interface org.drools.definition.rule.Rule
@Deprecated public Map<String,Object> getMetaAttributes()
getMetaAttributes
in interface org.drools.definition.rule.Query
getMetaAttributes
in interface org.drools.definition.rule.Rule
@Deprecated public String getMetaAttribute(String identifier)
getMetaAttribute
in interface org.drools.definition.rule.Query
getMetaAttribute
in interface org.drools.definition.rule.Rule
@Deprecated public Collection<String> listMetaAttributes()
listMetaAttributes
in interface org.drools.definition.rule.Query
listMetaAttributes
in interface org.drools.definition.rule.Rule
public void setParent(Rule parent)
public Rule getParent()
public static List getMethodBytecode(Class cls, String ruleClassName, String packageName, String methodName, String resource)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |