ABLE 2.0.0 07/02/2003 10:25:01

com.ibm.able.rules
Class AbleScriptEngine

java.lang.Object
  |
  +--com.ibm.able.rules.AbleInferenceEngine
        |
        +--com.ibm.able.rules.AbleScriptEngine
All Implemented Interfaces:
java.io.Serializable

public class AbleScriptEngine
extends AbleInferenceEngine

This class provides the control code for processing a set of rules in a ruleblock using standard sequential or scripting behavior.

The AbleScriptEngine processes all AbleRule types except predicate rules (which are ignored).

The major processing method is infer() which is called by the AbleRuleSet bean as part of the normal bean process() method.

Instances of this class are not directly constructed by the user but are dynamically created by the AbleRuleBlock init() method.

See Also:
AbleRuleSet, AbleRuleBlock, AbleAssertionRule, AblePredicateRule, Serialized Form

Fields inherited from class com.ibm.able.rules.AbleInferenceEngine
myDebugLevel, myRuleBlock, myRuleSet, myRulesFiredCount, myTracer, myWorkingMemory
 
Constructor Summary
AbleScriptEngine(AbleRuleSet theRuleSet, AbleLogger theTracer, AbleRuleBlock theRuleBlock)
          Create a new inference engine.
 
Method Summary
static java.lang.String Copyright()
          Determine the copyright of this class.
 java.lang.Object getControlParameter(java.lang.String theControlParameter)
          Returns the specified control parameter on the associated 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 examining the rule types and rule configurations.
 void setControlParameter(java.lang.String theControlParameter, java.lang.Object theValue)
          Set the specified control parameter on the associated inference engine.
 
Methods inherited from class com.ibm.able.rules.AbleInferenceEngine
askUser, conditionalRulesValid, evalAntecedentClause, evalAntecedentExpression, evalAssertionClause, evalAssertionRule, evalConditionalRule, evalConsequentClause, evalDoUntilRule, evalDoWhileRule, evalForLoopRule, evalIfThenElseRule, evalPatternMatchRule, evaluateDoActions, evalWhileDoRule, fireEngineBreakpoint, firePropertyChange, getRuleSet, getRulesFiredCount, getWorkingMemory, init, processAssertions, processConsequent, processRuleBlock, resetRuleSet, setControlParameters, setDebugLevel, setRuleSet, setWorkingMemory, startDebugConsole, stopDebugConsole, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AbleScriptEngine

public AbleScriptEngine(AbleRuleSet theRuleSet,
                        AbleLogger theTracer,
                        AbleRuleBlock theRuleBlock)
Create a new inference engine.
Parameters:
theRuleSet - A ruleset which serves as the context 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 examining the rule types and rule configurations.

The ruleblock is invalid if any of the following are present in any ruleblock:

  • Conditional rules
  • Predicate rules

    All reasons for validation failures are appended to the AbleRuleSet's myIsExReason variable. If validation fails, the inference engine must call myRuleSet.addIsExReason(java.lang.String) to append the reason.

    Overrides:
    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 infer() method is called by the AbleRuleSet process() code.

    Overrides:
    infer in class AbleInferenceEngine
    Parameters:
    theRuleBlock - The ruleblock whose rules are to be processed.

    Throws:
    AbleDataException - When any error occurs.
    See Also:
    AbleRuleBlock

    setControlParameter

    public void setControlParameter(java.lang.String theControlParameter,
                                    java.lang.Object theValue)
                             throws AbleDataException
    Set the specified control parameter on the associated inference engine.
    Overrides:
    setControlParameter in class AbleInferenceEngine

    getControlParameter

    public java.lang.Object getControlParameter(java.lang.String theControlParameter)
                                         throws AbleDataException
    Returns the specified control parameter on the associated inference engine.
    Overrides:
    getControlParameter in class AbleInferenceEngine

    Copyright

    public static java.lang.String Copyright()
    Determine the copyright of this class.
    Returns:
    A String containing this class's copyright statement.

    ABLE 2.0.0 07/02/2003 10:25:01

    (C) Copyright IBM Corporation 1999, 2003