nrc.fuzzy.jess
Class FuzzyToken

java.lang.Object
  |
  +--jess.Token
        |
        +--nrc.fuzzy.jess.FuzzyToken
All Implemented Interfaces:
java.io.Serializable

public class FuzzyToken
extends jess.Token
implements java.io.Serializable

Extends the Jess Token Class to allow the NRC FuzzyJ extensions to be used.

See Also:
Serialized Form

Constructor Summary
FuzzyToken(jess.Fact firstFact, int tag)
           
FuzzyToken(jess.Token t)
           
FuzzyToken(jess.Token t, jess.Fact newFact)
           
FuzzyToken(jess.Token lt, jess.Token rt)
           
 
Method Summary
 void addExtensionData(java.lang.Object obj)
          Add an Object to the m_extensionData Vector (in this case the Object will always be a FuzzyValueVector so we could change this Object to be a FuzzyValueVector).
 void clearExtensionData()
          Clear the values in the extension data Vector
 java.util.Vector getExtensionData()
          Get the Vector which is the extension data.
 nrc.fuzzy.jess.FuzzyToken getParent()
          Get the Parent of this token.
 jess.Token prepare(boolean success)
          Duplicate the token, if necessary, passing the extensionData to the new FuzzyToken and clearing it from the original.
 
Methods inherited from class jess.Token
dataEquals, equals, fact, fastDataEquals, hashCode, size, topFact, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

FuzzyToken

public FuzzyToken(jess.Fact firstFact,
                  int tag)
           throws jess.JessException

FuzzyToken

public FuzzyToken(jess.Token t,
                  jess.Fact newFact)
           throws jess.JessException

FuzzyToken

public FuzzyToken(jess.Token lt,
                  jess.Token rt)
           throws jess.JessException

FuzzyToken

public FuzzyToken(jess.Token t)
           throws jess.JessException
Method Detail

addExtensionData

public final void addExtensionData(java.lang.Object obj)
Add an Object to the m_extensionData Vector (in this case the Object will always be a FuzzyValueVector so we could change this Object to be a FuzzyValueVector).


getExtensionData

public final java.util.Vector getExtensionData()
Get the Vector which is the extension data. Normally this is a Vector of FuzzyValueVectors or empty (null).


clearExtensionData

public final void clearExtensionData()
Clear the values in the extension data Vector


getParent

public nrc.fuzzy.jess.FuzzyToken getParent()
Get the Parent of this token. This method added so that it is possible to traverse the tokens associated with an activation (these hold the facts that matched on the LHS). This is used by the fuzzy extension to allow one to store the fuzzy values that matched during a 'fuzzy-match' function call during the pattern matching phase.

Returns:
Returns the parent token of this token.

prepare

public jess.Token prepare(boolean success)
                   throws jess.JessException
Duplicate the token, if necessary, passing the extensionData to the new FuzzyToken and clearing it from the original. This is determined by the parameter to prepare. If true then the pattern match for the fact was successful and if there was 'extensionData' we need to pass this to the new duplicate token and remove it from the original token. If false then the pattern match failed so we need to clear the extension data from the original token.

Overrides:
prepare in class jess.Token
Parameters:
success - true if the pattern match for the fact associated with this token was true, else false.
Returns:
Returns the token itself (this) with any extensionData removed if the pattern match just completed was unsuccessful or a new token that is a copy of this token with any extension data passed along if the pattern match was successful.
jess.JessException