net.sourceforge.jFuzzyLogic.rule
Class FuzzyRuleExpression

java.lang.Object
  extended by net.sourceforge.jFuzzyLogic.rule.FuzzyRuleExpression

public class FuzzyRuleExpression
extends java.lang.Object

General rule expression term E.g.: "(temp IS hot AND pressure IS high) OR pressure IS low"

Author:
pcingola@users.sourceforge.net

Field Summary
(package private)  boolean negated
          Is it negated?
(package private)  RuleConnectionMethod ruleConnectionMethod
          How are term1 and term2 connected?
(package private)  java.lang.Object term1
          Term1 can be a either a 'FuzzyRuleTerm' or 'FuzzyRuleExpression'
(package private)  java.lang.Object term2
          Term2 can be a either a 'FuzzyRuleTerm' or 'FuzzyRuleExpression'
 
Constructor Summary
FuzzyRuleExpression()
          Default Constructor
FuzzyRuleExpression(java.lang.Object term1, java.lang.Object term2, RuleConnectionMethod ruleConnectionMethod)
          Constructor
 
Method Summary
 void add(FuzzyRuleTerm fuzzyRuleTerm)
          Add a new term (using default AND method)
private  void addVariables(java.util.LinkedList linkedListVariables)
          Add every variable to this list
 double evaluate()
          Evaluate this expression
 RuleConnectionMethod getRuleConnectionMethod()
           
 java.lang.Object getTerm1()
           
 java.lang.Object getTerm2()
           
 boolean isFuzzyRuleExpression(java.lang.Object term)
          Is this term an expression ('FuzzyRuleExpression')
 boolean isFuzzyRuleTerm(java.lang.Object term)
          Is this term a FuzzyRuleTerm
 boolean isNegated()
           
 boolean isValidTerm(java.lang.Object term)
          Is this a valid term? (only a few objects are acceped as 'terms')
 java.util.Iterator iteratorVariables()
          Iterate on every variable
 void setNegated(boolean negated)
           
 void setRuleConnectionMethod(RuleConnectionMethod ruleConnectionMethod)
           
 void setTerm1(java.lang.Object term1)
           
 void setTerm2(java.lang.Object term2)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

negated

boolean negated
Is it negated?


ruleConnectionMethod

RuleConnectionMethod ruleConnectionMethod
How are term1 and term2 connected?


term1

java.lang.Object term1
Term1 can be a either a 'FuzzyRuleTerm' or 'FuzzyRuleExpression'


term2

java.lang.Object term2
Term2 can be a either a 'FuzzyRuleTerm' or 'FuzzyRuleExpression'

Constructor Detail

FuzzyRuleExpression

public FuzzyRuleExpression()
Default Constructor


FuzzyRuleExpression

public FuzzyRuleExpression(java.lang.Object term1,
                           java.lang.Object term2,
                           RuleConnectionMethod ruleConnectionMethod)
Constructor

Parameters:
term1 - : term 1 (can be a either a 'FuzzyRuleTerm' or 'FuzzyRuleExpression')
term2 - : term 2 (can be a either a 'FuzzyRuleTerm' or 'FuzzyRuleExpression')
ruleConnectionMethod - : connection method between terms (which method is used for each 'and', 'or', 'not'...)
Method Detail

add

public void add(FuzzyRuleTerm fuzzyRuleTerm)
Add a new term (using default AND method)

Parameters:
fuzzyRuleTerm - : term to add

addVariables

private void addVariables(java.util.LinkedList linkedListVariables)
Add every variable to this list

Parameters:
linkedListVariables -

evaluate

public double evaluate()
Evaluate this expression

Returns:
evaluation's result

getRuleConnectionMethod

public RuleConnectionMethod getRuleConnectionMethod()

getTerm1

public java.lang.Object getTerm1()

getTerm2

public java.lang.Object getTerm2()

isFuzzyRuleExpression

public boolean isFuzzyRuleExpression(java.lang.Object term)
Is this term an expression ('FuzzyRuleExpression')

Parameters:
term - : term to analize
Returns:
true if it's an 'FuzzyRuleExpression', false otherwise

isFuzzyRuleTerm

public boolean isFuzzyRuleTerm(java.lang.Object term)
Is this term a FuzzyRuleTerm

Parameters:
term - : term to analize
Returns:
true if it's an 'FuzzyRuleTerm', false otherwise

isNegated

public boolean isNegated()

isValidTerm

public boolean isValidTerm(java.lang.Object term)
Is this a valid term? (only a few objects are acceped as 'terms')

Parameters:
term - : Term to evaluate

iteratorVariables

public java.util.Iterator iteratorVariables()
Iterate on every variable

Returns:
a 'variables' iterator

setNegated

public void setNegated(boolean negated)

setRuleConnectionMethod

public void setRuleConnectionMethod(RuleConnectionMethod ruleConnectionMethod)

setTerm1

public void setTerm1(java.lang.Object term1)

setTerm2

public void setTerm2(java.lang.Object term2)

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object