|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--rule.BooleanRuleBase
The BooleanRuleBase
class implements a set of rules and rule
variables along with methods for forward and backward chaining.
Field Summary | |
(package private) Clause |
clausePtr
|
(package private) Clause[] |
clauseVarList
|
(package private) java.util.Vector |
conclusionVarList
|
(package private) java.util.Hashtable |
effectors
|
(package private) java.util.Vector |
factList
|
(package private) java.util.Stack |
goalClauseStack
|
(package private) java.lang.String |
name
|
(package private) java.util.Vector |
ruleList
|
(package private) Rule |
rulePtr
|
(package private) java.util.Hashtable |
sensors
|
(package private) javax.swing.JTextArea |
textArea1
|
(package private) java.util.Hashtable |
variableList
|
Constructor Summary | |
BooleanRuleBase(java.lang.String name)
Creates a BooleanRuleBase with the given name. |
Method Summary | |
void |
addEffector(java.lang.Object obj,
java.lang.String effectorName)
Adds an effector and effector name to the rule base. |
void |
addFact(Fact fact)
Adds a fact to this rule base. |
void |
addSensor(java.lang.Object obj,
java.lang.String sensorName)
Adds a sensor and sensor name to the rule base. |
void |
addVariable(RuleVariable variable)
Adds a variable to this rule base |
void |
backwardChain(java.lang.String goalVarName)
Determines if the given goal is true by finding the set of rules that refer to the goal in their consequent clause and then testing the antecedent clauses to determine if the rule should fire. |
void |
displayConflictSet(java.util.Vector ruleSet)
Dislays all rules in the conflict set. |
void |
displayRules(javax.swing.JTextArea textArea)
Displays all the rules and facts in text format in the given text area. |
void |
displayVariables(javax.swing.JTextArea textArea)
Displays all variables and their values in the given text area. |
void |
forwardChain()
Fires rules, generating new data, based on the initial set of data. |
java.lang.Object |
getEffectorObject(java.lang.String effectorName)
Retrieves the effector associated with the given name. |
java.util.Vector |
getGoalVariables()
Retreives all the variables referenced in the consequent of any rule in the rule base. |
java.lang.Object |
getSensorObject(java.lang.String sensorName)
Retrieves the sensor associated with the given name. |
RuleVariable |
getVariable(java.lang.String name)
Retrives the variable associated with the given name. |
java.util.Hashtable |
getVariables()
Retrieves the list of variables. |
void |
initializeFacts()
Initializes the facts associated with this rule base. |
java.util.Vector |
match(boolean test)
Finds the set of rules that can fire when forward chaining. |
void |
reset()
Resets the rule base for another round of inferencing. |
Rule |
selectRule(java.util.Vector ruleSet)
Selects a rule to fire when forward chaining, based on specificity. |
void |
setDisplay(javax.swing.JTextArea txtArea)
Sets the text area for the display of information. |
void |
setVariableValue(java.lang.String name,
java.lang.String value)
Sets the value of the variable associated with the given name. |
void |
trace(java.lang.String text)
Adds the given text to the trace information. |
Methods inherited from class java.lang.Object |
|
Field Detail |
java.lang.String name
java.util.Hashtable variableList
Clause[] clauseVarList
java.util.Vector ruleList
java.util.Vector conclusionVarList
Rule rulePtr
Clause clausePtr
java.util.Stack goalClauseStack
java.util.Hashtable effectors
java.util.Hashtable sensors
java.util.Vector factList
javax.swing.JTextArea textArea1
Constructor Detail |
public BooleanRuleBase(java.lang.String name)
BooleanRuleBase
with the given name.name
- the String that contains the name of the rule baseMethod Detail |
public void setDisplay(javax.swing.JTextArea txtArea)
txtArea
- the JTextArea to be used for the display of informationpublic void trace(java.lang.String text)
text
- the String that contains the text to be displayed as part of the
trace informationpublic void displayVariables(javax.swing.JTextArea textArea)
textArea
- the JTextArea where the variables and their values are
displayedpublic void displayRules(javax.swing.JTextArea textArea)
textArea
- the JTextArea where the rules and facts are displayedpublic void displayConflictSet(java.util.Vector ruleSet)
ruleSet
- the Vector that contains the conflict set of rulespublic void reset()
public void backwardChain(java.lang.String goalVarName)
goalVarName
- the String that contains the name fo the goal variablepublic java.util.Vector match(boolean test)
test
- the boolean value that determines if the antecedents should be
tested (true
) or just checked (false
)public Rule selectRule(java.util.Vector ruleSet)
ruleSet
- the Vector of rules that can firepublic void forwardChain()
public void addEffector(java.lang.Object obj, java.lang.String effectorName)
obj
- the Object that contains the effectoreffectorName
- the String that contains the name of the effectorpublic java.lang.Object getEffectorObject(java.lang.String effectorName)
effectorName
- the String that contains the name of the effector to be
be retrievedpublic void addSensor(java.lang.Object obj, java.lang.String sensorName)
obj
- the Object that contains the sensorsensorName
- the String that contains the name of the sensorpublic java.lang.Object getSensorObject(java.lang.String sensorName)
sensorName
- the String that contains the name of the sensor to be
be retrievedpublic void initializeFacts()
public void addFact(Fact fact)
fact
- the Fact to be added to the rule basepublic void addVariable(RuleVariable variable)
variable
- the Variable to be added to the rule basepublic java.util.Hashtable getVariables()
public java.util.Vector getGoalVariables()
public RuleVariable getVariable(java.lang.String name)
name
- the String that contains the name of the variablepublic void setVariableValue(java.lang.String name, java.lang.String value)
name
- the String that contains the name of the variablevalue
- the String object that contains
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |