public class BasicRule extends Object implements Rule, Comparable<Rule>
evaluate(Facts) and execute(Facts) to provide rule
conditions and actions logic.| Modifier and Type | Field and Description |
|---|---|
protected String |
description
Rule description.
|
protected String |
name
Rule name.
|
protected int |
priority
Rule priority.
|
DEFAULT_DESCRIPTION, DEFAULT_NAME, DEFAULT_PRIORITY| Constructor and Description |
|---|
BasicRule()
Create a new
BasicRule. |
BasicRule(String name)
Create a new
BasicRule. |
BasicRule(String name,
String description)
Create a new
BasicRule. |
BasicRule(String name,
String description,
int priority)
Create a new
BasicRule. |
| Modifier and Type | Method and Description |
|---|---|
int |
compareTo(Rule rule) |
boolean |
equals(Object o) |
boolean |
evaluate(Facts facts)
Rule conditions abstraction : this method encapsulates the rule's conditions.
|
void |
execute(Facts facts)
Rule actions abstraction : this method encapsulates the rule's actions.
|
String |
getDescription()
Getter for rule description.
|
String |
getName()
Getter for rule name.
|
int |
getPriority()
Getter for rule priority.
|
int |
hashCode() |
void |
setDescription(String description) |
void |
setPriority(int priority) |
String |
toString() |
protected String name
protected String description
protected int priority
public BasicRule()
BasicRule.public BasicRule(String name, String description)
BasicRule.name - rule namedescription - rule descriptionpublic boolean evaluate(Facts facts)
public void execute(Facts facts) throws Exception
public String getDescription()
RulegetDescription in interface Rulepublic void setDescription(String description)
public int getPriority()
RulegetPriority in interface Rulepublic void setPriority(int priority)
public int compareTo(Rule rule)
compareTo in interface Comparable<Rule>Copyright © 2017. All Rights Reserved.