public abstract class AbstractRule extends Object implements Rule
AbstractRule implements action, active status, name and salience
manipulation. The rest is for subclasses, ie execute() interface
method.Rule by default.| Constructor and Description |
|---|
AbstractRule(String name,
int salience) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
activate()
Set rule state to active
|
boolean |
addCommand(RuledCommand action)
Add an
RuledCommand to fire when rule matches |
void |
clearCommands()
Remove all actions triggered by this
Rule when it matches. |
void |
executeCommands()
call each
RuledCommand execute() method |
List<RuledCommand> |
getCommands() |
Object |
getFact() |
List<Rule> |
getFollowing() |
String |
getName() |
List<Rule> |
getPreceeding() |
Report |
getReport() |
int |
getSalience()
Rule salience is an int between -100 an 100.
|
boolean |
isActive() |
boolean |
passivate()
Set rule state to passive (will not be processed)
|
boolean |
removeCommand(RuledCommand action)
Remove an
RuledCommand to fire when rule matches |
protected void |
setFact(Object fact) |
void |
setFollowingRules(List<Rule> fRules) |
void |
setPreceedingRules(List<Rule> pRules) |
protected void |
setReport(Report context) |
public AbstractRule(String name, int salience)
public final void executeCommands()
RuledCommand execute() methodexecuteCommands in interface Rulepublic final boolean addCommand(RuledCommand action)
RuleRuledCommand to fire when rule matchesaddCommand in interface Rulepublic final boolean removeCommand(RuledCommand action)
RuleRuledCommand to fire when rule matchesremoveCommand in interface Rulepublic final List<RuledCommand> getCommands()
getCommands in interface RuleRuledCommand to fire when rule matchespublic int getSalience()
RulegetSalience in interface Rulepublic boolean isActive()
public boolean activate()
Rulepublic boolean passivate()
Rulepublic void clearCommands()
RuleRule when it matches.clearCommands in interface Rulepublic Object getFact()
getFact in interface RuleIllegalStateException.protected void setFact(Object fact)
protected void setReport(Report context)
public Report getReport()
getReport in interface RuleIllegalStateException if null.public List<Rule> getFollowing()
getFollowing in interface HasFollowing<Rule>public List<Rule> getPreceeding()
getPreceeding in interface HasPreceeding<Rule>Copyright © 2012. All Rights Reserved.