rule
Class FuzzyRule

java.lang.Object
  |
  +--rule.FuzzyRule

public class FuzzyRule
extends java.lang.Object

The FuzzyRule class implements a fuzzy rule with multiple antecedent clauses and a single consequent clause.


Constructor Summary
(package private) FuzzyRule(FuzzyRuleBase rb, java.lang.String name, FuzzyClause rhs)
          Creates a new fuzzy unconditional rule (a Fact).
(package private) FuzzyRule(FuzzyRuleBase rb, java.lang.String name, FuzzyClause[] lhsClauses, FuzzyClause rhs)
          Creates a new fuzzy rule with one or more antecedent clauses and a single consequent clause.
(package private) FuzzyRule(FuzzyRuleBase rb, java.lang.String name, FuzzyClause lhs, FuzzyClause rhs)
          Creates a new fuzzy rule with a single antecedent and a single consequent clause.
 
Method Summary
(package private)  void addRdReference(int id)
          Adds to the set of variables referenced in this rule.
(package private)  void addWrReference(int id)
          Adds to the set of variables set by this rule.
(package private)  void fire(double alphaCut, java.util.BitSet workingSet)
          Fires this rule.
 java.util.Vector getAntecedents()
          Retrieves the antecedent clauses of this rule.
 FuzzyClause getConsequent()
          Retrieves the consequent clause.
 java.lang.String getName()
          Retrieves the name of this rule.
 java.util.BitSet getRdReferences()
          Retrieves the set of the variables referenced in this rule.
 java.util.BitSet getWrReferences()
          Retrieves the set of the variables set by this rule.
 boolean isFired()
          Retrieves the flag that indicates if this rule has been fired.
(package private)  void reset()
          Resets the rule (fired flag).
 java.lang.String toString()
          Retrieve a string describing the contents of the object.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

FuzzyRule

FuzzyRule(FuzzyRuleBase rb,
          java.lang.String name,
          FuzzyClause lhs,
          FuzzyClause rhs)
Creates a new fuzzy rule with a single antecedent and a single consequent clause.
Parameters:
rb - the FuzzyRuleBase object this rule belongs to
name - the String object that contains the name of the rule
lhs - the FuzzyClause object that contains the antecedent clause
rhs - the FuzzyClause object the contains the consequent clause

FuzzyRule

FuzzyRule(FuzzyRuleBase rb,
          java.lang.String name,
          FuzzyClause[] lhsClauses,
          FuzzyClause rhs)
Creates a new fuzzy rule with one or more antecedent clauses and a single consequent clause.
Parameters:
rb - the FuzzyRuleBase object this rule belongs to
name - the String object that contains the name of the rule
lhsClauses - the FuzzyClause[] object that contains the antecedent clauses
rhs - the consequent FuzzyClause object the contains the consequent clause

FuzzyRule

FuzzyRule(FuzzyRuleBase rb,
          java.lang.String name,
          FuzzyClause rhs)
Creates a new fuzzy unconditional rule (a Fact).
Parameters:
rb - the FuzzyRuleBase object that this rule belongs to
name - the String that contains the rule name
rhs - the FuzzyClause object that contains the consequent clause
Method Detail

getName

public java.lang.String getName()
Retrieves the name of this rule.
Returns:
the String object that contains the name of the rule

addRdReference

void addRdReference(int id)
Adds to the set of variables referenced in this rule.
Parameters:
id - the integer that represents the id of the variable referenced

getRdReferences

public java.util.BitSet getRdReferences()
Retrieves the set of the variables referenced in this rule.
Returns:
the BitSet object that represents the referenced variables

addWrReference

void addWrReference(int id)
Adds to the set of variables set by this rule.
Parameters:
id - the integer that represents the id of the variable referenced

getWrReferences

public java.util.BitSet getWrReferences()
Retrieves the set of the variables set by this rule.
Returns:
the BitSet object that represents the referenced variables

isFired

public boolean isFired()
Retrieves the flag that indicates if this rule has been fired.
Returns:
the boolean true if fired or false if not fired

reset

void reset()
Resets the rule (fired flag).

getAntecedents

public java.util.Vector getAntecedents()
Retrieves the antecedent clauses of this rule.
Returns:
the Vector object that contains the antecedents

getConsequent

public FuzzyClause getConsequent()
Retrieves the consequent clause.
Returns:
the FuzzyClause object that contains the consequent

fire

void fire(double alphaCut,
          java.util.BitSet workingSet)
Fires this rule.

If this is an unconditional rule (there are no antecedents), simply evaluates the consequent for its side-effects.

If this is a conditional rule (there are antecedents), evaluates the antecedents:

Parameters:
alphaCut - the double value for the alphaCut
workingSet - the BitSet object that contains the working set

toString

public java.lang.String toString()
Retrieve a string describing the contents of the object.
Returns:
a String containing the current contents of the object
Overrides:
toString in class java.lang.Object