|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--rule.Rule
The Rule
class implements a rule with multiple antecedent clauses
and a single consequent clause.
Field Summary | |
(package private) Clause[] |
antecedents
|
(package private) Clause |
consequent
|
(package private) boolean |
fired
|
(package private) java.lang.String |
name
|
(package private) BooleanRuleBase |
rb
|
(package private) java.lang.Boolean |
truth
|
Constructor Summary | |
Rule(BooleanRuleBase rb,
java.lang.String name,
Clause[] lhsClauses,
Clause rhs)
Creates a Rule for the given rule base, with the given name,
one or more antecedents and consequent. |
|
Rule(BooleanRuleBase rb,
java.lang.String name,
Clause lhs,
Clause rhs)
Creates a Rule for the given rule base, with the given name,
antecedent and consequent. |
Method Summary | |
(package private) java.lang.Boolean |
backChain()
Determines if a rule is true by recursively trying to prove its antecedent clauses are true or by determining that any of its antecedent clauses are false. |
(package private) java.lang.Boolean |
check()
Tests the antecedent clauses in this rule in a forward chaining system. |
static void |
checkRules(java.util.Vector clauseRefs)
Retests all clauses and rules that reference a variable in a forward chaining system. |
(package private) void |
display(javax.swing.JTextArea textArea)
Displays this rule in text format in the given text area. |
(package private) void |
fire()
Fires a rule in a forward chaining system by performing the consequent clause, updating all clauses where any changed variables are referenced, and updating all the rules that contain those clauses. |
(package private) long |
numAntecedents()
Retrieves the number of antecedent clauses in this rule. |
(package private) void |
reset()
Resets the rule, allowing it to be fired again. |
Methods inherited from class java.lang.Object |
|
Field Detail |
BooleanRuleBase rb
java.lang.String name
Clause[] antecedents
Clause consequent
java.lang.Boolean truth
boolean fired
Constructor Detail |
public Rule(BooleanRuleBase rb, java.lang.String name, Clause lhs, Clause rhs)
Rule
for the given rule base, with the given name,
antecedent and consequent.rb
- the BooleanRuleBase associated with this rulename
- the String that contains the name of the rulelhs
- the antecedent clause of this rulerhs
- the consequent clause of this rulepublic Rule(BooleanRuleBase rb, java.lang.String name, Clause[] lhsClauses, Clause rhs)
Rule
for the given rule base, with the given name,
one or more antecedents and consequent.rb
- the BooleanRuleBase associated with this rulename
- the String that contains the name of the ruleantecedents
- the antecedent clauses of this rulelhsClauses
- the Clause[] objectrhs
- the consequent clause of this ruleMethod Detail |
long numAntecedents()
public static void checkRules(java.util.Vector clauseRefs)
clauseRefs
- the Vector that contains the clauses that reference a
certain variablejava.lang.Boolean check()
true
if all the antecedent clauses are true, false
if any of the antecedent clauses are false, or null
if the truth value of any of the antecedent clauses cannot be
determinedvoid fire()
java.lang.Boolean backChain()
true
if the antecedent clauses of this rule can be
proven true, or false
if any of the antecedents
are false.void display(javax.swing.JTextArea textArea)
textArea
- the JTextArea where the rule is displayedvoid reset()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |