nrc.fuzzy.jess
Class FuzzyFunctions.FuzzyMatch

java.lang.Object
  |
  +--nrc.fuzzy.jess.FuzzyFunctions.FuzzyMatch
All Implemented Interfaces:
java.io.Serializable, jess.Userfunction
Enclosing class:
FuzzyFunctions

public class FuzzyFunctions.FuzzyMatch
extends java.lang.Object
implements jess.Userfunction, java.io.Serializable

Userfunction class:

Implements the Jess user function (fuzzy-match fv1 fv2)

where fv1 and fv2 are both FuzzyValue instances

or one is a FuzzyValue and the other is a string that represents a valid linguistic expression.

The function returns true if the 2 FuzzyValues have some overlapping portion that has a membership value at least as large as the current setting of the FuzzyValue match Threshold (see FuzzyValue static method setMatchThreshold).

This is used in Jess rules to test FuzzyValues for 'equality' on the LHS. Consider the simple rule below. NOTE: This Jess user function must be used for matching of FuzzyValues on the LHS of rules and not the FuzzyValue method fuzzyMatch since it interacts with the Jess rete engine, providing the strong connection between Jess and the NRC fuzzy API.

    (defrule cold_strong "match on cold temperature and strong flow"
      (temp ?t&:(fuzzy-match ?t "cold"))
      (flow ?f&:(fuzzy-match ?f "strong"))
     =>
      (assert (change_hv (new nrc.fuzzy.FuzzyValue ?*hotValveChangeFvar* "Z"))
              (change_cv (new nrc.fuzzy.FuzzyValue ?*coldValveChangeFvar* "NB"))
      )
    )
 

See Also:
Serialized Form

Constructor Summary
FuzzyFunctions.FuzzyMatch()
           
 
Method Summary
 jess.Value call(jess.ValueVector vv, jess.Context context)
           
 java.lang.String getName()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FuzzyFunctions.FuzzyMatch

public FuzzyFunctions.FuzzyMatch()
Method Detail

getName

public java.lang.String getName()
Specified by:
getName in interface jess.Userfunction
Returns:
String the name of the Jess function

call

public jess.Value call(jess.ValueVector vv,
                       jess.Context context)
                throws jess.JessException
Specified by:
call in interface jess.Userfunction
Parameters:
vv - a ValueVector with the function arguments, 2 FuzzyValue objects
context -
Returns:
Value TRUE if the fuzzy values match else FALSE
Throws:
jess.JessException