Overview | Package | Class | Use | Tree | Serialized | Deprecated | Index | Help
| ABLE 2.3.0 07/13/2005 14:21:00
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.ibm.able.examples.rules
Class PluggableEngine

    java.lang.Object
      com.ibm.able.rules.AbleInferenceEngine
          com.ibm.able.examples.rules.PluggableEngine

All Implemented Interfaces:
  java.io.Serializable

public class PluggableEngine
extends AbleInferenceEngine

This class extends the AbleInferenceEngine class so that it can be used as a customized pluggable inference engine. It can be used in any AbleRuleSet by specifying " using com.ibm.able.examples.rules.PluggableEngine" on the ruleblock definition.

See Also:
  Serialized Form

Field Summary

Fields inherited from class com.ibm.able.rules.AbleInferenceEngine
`myDebugLevel, myRuleBlock, myRuleSet, myRulesFiredCount, myTracer, myWorkingMemory`

Constructor Summary
`PluggableEngine(AbleRuleSet theRuleSet, AbleLogger theTracer, AbleRuleBlock theRuleBlock)` Create a new inference engine.

Method Summary
`java.lang.Object` | `getControlParameter(java.lang.String theControlParameter)` Get the specified control parameter on this inference engine.
`void` | `infer(AbleRuleBlock theRuleBlock)` Fire the rules in the ruleset in sequential order.
`boolean` | `isRuleBlockValid(AbleRuleBlock theRuleBlock)` Make sure the current ruleblock is "executable" by this inference engine.
`void` | `reevaluateClausesWithChangedVariable(AbleClauseReferences theClauseReferences)` Re-evaluate, if necessary, the specified clauses that contain a reference to a variable whose current value has just changed.
`void` | `setControlParameter(java.lang.String theControlParameter, java.lang.Object theValue)` Set the specified control parameter on this inference engine.

Methods inherited from class com.ibm.able.rules.AbleInferenceEngine
`allocateWorkingMemory, askUser, conditionalRulesValid, evalAntecedentClause, evalAntecedentExpression, evalAssertionClause, evalAssertionRule, evalConditionalRule, evalConsequentClause, evalDoUntilRule, evalDoWhileRule, evalForLoopRule, evalIfThenElseRule, evalPatternMatchRule, evalSwitchRule, evaluateDoActions, evalWhileDoRule, fireEngineBreakpoint, firePropertyChange, getRuleSet, getRulesFiredCount, getWorkingMemory, init, processAssertions, processConsequent, processConsequent, processConsequentClauses, processRuleBlock, reset, resetRuleSet, setControlParameters, setDebugLevel, setInferenceContext, setInferenceContext, setInferenceContext, setRuleSet, setWorkingMemory, startDebugConsole, stopDebugConsole, toString`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Constructor Detail

### PluggableEngine

    public PluggableEngine(AbleRuleSet theRuleSet,
                           AbleLogger theTracer,
                           AbleRuleBlock theRuleBlock)

  Create a new inference engine.

Parameters:
  `theRuleSet` - A ruleset whose context is used for inferencing by this inference engine.

  `theTracer` - A tracer object to which this inference engine can log information. This may be null, in which case no information is logged.

  `theRuleBlock` - A ruleblock whose rules are to be used for inferencing by this inference engine.

Method Detail

### isRuleBlockValid

    public boolean isRuleBlockValid(AbleRuleBlock theRuleBlock)

  Make sure the current ruleblock is "executable" by this inference engine.

  Here is the place where the custom engine examines the rules the user coded in this ruleblock to see if they are acceptable for processing by this engine. In this example, we simply say whatever they pass is ok for us since we are going to ignore all but assertions anyway.

  Specified by:
    `isRuleBlockValid` in class `AbleInferenceEngine`
  Returns:
    true, if the ruleset is OK; false, if the ruleset is not executable.

### infer

    public void infer(AbleRuleBlock theRuleBlock)
               throws AbleDataException

  Fire the rules in the ruleset in sequential order.

  The order of processing is as follows:

  1. All rules in the ruleblock are fired sequentially.

  Specified by:
    `infer` in class `AbleInferenceEngine`
  Parameters:
    `theRuleBlock` - The ruleblock used by this inference engine.

  Throws:
    `AbleDataException` - When any error occurs.

### reevaluateClausesWithChangedVariable

    public void reevaluateClausesWithChangedVariable(AbleClauseReferences theClauseReferences)
                                              throws AbleDataException

  Re-evaluate, if necessary, the specified clauses that contain a reference to a variable whose current value has just changed. This engine processes only antecedent clauses.

  Parameters:
    `theClauseReferences` - A collection of clauses that reference some variable whose current value has just changed.

  Throws:
    `AbleDataException`

### setControlParameter

    public void setControlParameter(java.lang.String theControlParameter,
                                    java.lang.Object theValue)
                             throws AbleDataException

  Set the specified control parameter on this inference engine. Both the parameter name and value must be validated in this method.

  Specified by:
    `setControlParameter` in class `AbleInferenceEngine`
  Throws:
    `AbleDataException`

### getControlParameter

    public java.lang.Object getControlParameter(java.lang.String theControlParameter)
                                         throws AbleDataException

  Get the specified control parameter on this inference engine.

  Specified by:
    `getControlParameter` in class `AbleInferenceEngine`
  Throws:
    `AbleDataException`

Overview | Package | Class | Use | Tree | Serialized | Deprecated | Index | Help
| ABLE 2.3.0 07/13/2005 14:21:00
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

(C) Copyright IBM Corporation 1999, 2005