nrc.fuzzy.jess
Class FuzzyRete

java.lang.Object
  |
  +--jess.Rete
        |
        +--nrc.fuzzy.jess.FuzzyRete
All Implemented Interfaces:
java.util.EventListener, jess.JessListener, java.io.Serializable

public class FuzzyRete
extends jess.Rete
implements java.io.Serializable

The reasoning engine, extended to support fuzzy reasoning. Executes the built Rete network, and coordinates many other activities.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class jess.Rete
ACTIVATE, EVERY_TIME, INSTALL
 
Constructor Summary
FuzzyRete()
           
FuzzyRete(java.applet.Applet a)
           
 
Method Summary
protected  void aboutToFire(jess.Activation a)
          Records the current activation during a rule firing.
 int doPreAssertionProcessing(jess.Fact f)
          Special preprocessing when asserting a fact with fuzzy values in it.
protected  jess.Activation getCurrentActivation()
          Get the current rule activation.
 nrc.fuzzy.FuzzyRule getCurrentActivationFuzzyRule()
          Get the current FuzzyRule in the activation.
 nrc.fuzzy.jess.GlobalContributionOperator getFuzzyGlobalContributionOperator()
          Gets the current GlobalContributionOperator object that implements the execute method to do global contribution.
 java.util.Vector getFuzzyMatchesInActivation(jess.Activation a)
          Finds any Fuzzy matches (antecedent/input pairs) that were made on the LHS of the rule.
protected  void justFired(jess.Activation a)
          Clears the current activation when a rule finishes firing.
 boolean setFuzzyGlobalContributionOperator(nrc.fuzzy.jess.GlobalContributionOperator op)
          Sets the type of global contribution to do.
 
Methods inherited from class jess.Rete
add, addAll, addAll, addDebugListener, addDeffacts, addDefglobal, addDefglobals, addDefmodule, addDefmodule, addDefmodule, addDefrule, addDeftemplate, addInputRouter, addJessListener, addOutputRouter, addUserfunction, addUserpackage, assertFact, assertFact, assertString, assertString, batch, bload, bsave, clear, clearFocusStack, clearStorage, containsObject, countQueryResults, countQueryResults, createDeftemplate, defclass, defclass, defineFeature, definstance, definstance, eval, eval, eventHappened, executeCommand, executeCommand, fetch, findClass, findDeffacts, findDefglobal, findDefrule, findDeftemplate, findFactByFact, findFactByID, findUserfunction, getActivationSemaphore, getApplet, getAppObjectClass, getClassLoader, getCurrentModule, getErrStream, getEvalSalience, getEventMask, getFactory, getFocus, getGlobalContext, getInputMode, getInputRouter, getObjects, getOutputRouter, getOutStream, getResetGlobals, getResource, getStrategy, getSupportedFacts, getSupportingTokens, getThisActivation, getThisRuleName, halt, importClass, importPackage, isDebug, isFeatureDefined, isHalted, javaClassForDefclass, listActivations, listActivations, listDebugListeners, listDefclasses, listDeffacts, listDefglobals, listDefinstances, listDefrules, listDeftemplates, listFacts, listFocusStack, listFunctions, listJessListeners, listModules, lookupFunction, mark, modify, modify, modify, modify, peekNextActivation, popFocus, ppFacts, ppFacts, recordFunction, recordFunction, removeDebugListener, removeInputRouter, removeJessListener, removeOutputRouter, removeUserDefinedFunctions, removeUserfunction, reset, resetToMark, resolveName, retract, retractString, run, run, runQuery, runQuery, runQueryStar, runQueryStar, runUntilHalt, setApplet, setAppObject, setClassLoader, setCurrentModule, setDebug, setEvalSalience, setEventMask, setFactory, setFocus, setPassiveMode, setPendingFact, setResetGlobals, setStrategy, setWatchRouter, store, store, toString, unDeffacts, undefinstance, unDefrule, unwatch, unwatchAll, updateObject, updateObject, verifyModule, waitForActivations, watch, watchAll
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

FuzzyRete

public FuzzyRete()

FuzzyRete

public FuzzyRete(java.applet.Applet a)
Parameters:
a -
Method Detail

getFuzzyMatchesInActivation

public java.util.Vector getFuzzyMatchesInActivation(jess.Activation a)
Finds any Fuzzy matches (antecedent/input pairs) that were made on the LHS of the rule. When a fuzzy match was made (fuzzy-match function) the pairs were stored in the appropriate token (in the special extensionData slot) which ultimately was linked in the m_token slot of the activation.

Parameters:
a - The rule activation to be searched for Fuzzy matches.
Returns:
A Vector with the fuzzy match pairs or null if no match pairs

doPreAssertionProcessing

public int doPreAssertionProcessing(jess.Fact f)
                             throws jess.JessException
Special preprocessing when asserting a fact with fuzzy values in it. Some special additions for dealing with fuzzy facts and fuzzy inferencing. In particular the FuzzyValues in the asserted fact will be modified if there are fuzzy matches on the LHS of the rule and if there exists an equivalent fact with fuzzy values already, that fact and the new one are combined (fuzzy global contribution).

Overrides:
doPreAssertionProcessing in class jess.Rete
Parameters:
f - the fact being asserted
Returns:
int
Throws:
jess.JessException

getCurrentActivation

protected jess.Activation getCurrentActivation()
Get the current rule activation.


getCurrentActivationFuzzyRule

public nrc.fuzzy.FuzzyRule getCurrentActivationFuzzyRule()
Get the current FuzzyRule in the activation.


aboutToFire

protected void aboutToFire(jess.Activation a)
Records the current activation during a rule firing.

Overrides:
aboutToFire in class jess.Rete

justFired

protected void justFired(jess.Activation a)
Clears the current activation when a rule finishes firing.

Overrides:
justFired in class jess.Rete

setFuzzyGlobalContributionOperator

public boolean setFuzzyGlobalContributionOperator(nrc.fuzzy.jess.GlobalContributionOperator op)
Sets the type of global contribution to do. Wil normally be one of:
a UnionGlobalContributionOperator - do a fuzzy union of FuzzyValues
a SumGlobalContributionOperator - do a fuzzy Sum of FuzzyValues
null - do no global contribution (replace with new FuzzyValues)

Parameters:
op - the GlobalContributionOperator that provides the required execute method to combine the new and existing fuzzy values when global contribution is being done.
Returns:
true if successful else false (actually can't fail)

getFuzzyGlobalContributionOperator

public nrc.fuzzy.jess.GlobalContributionOperator getFuzzyGlobalContributionOperator()
Gets the current GlobalContributionOperator object that implements the execute method to do global contribution. Will normally be one of:
a UnionGlobalContributionOperator - do a fuzzy union of FuzzyValues
a SumGlobalContributionOperator - do a fuzzy Sum of FuzzyValues
null - do no global contribution (replace with new FuzzyValues)

Returns:
an GlobalContributionOperator object or null.