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.rules
Class AblePolicyEngine

    java.lang.Object
      com.ibm.able.rules.AbleInferenceEngine
          com.ibm.able.rules.AblePolicyEngine

All Implemented Interfaces:
  java.io.Serializable

public class AblePolicyEngine
extends AbleInferenceEngine
implements java.io.Serializable

This class provides the inferencing algorithm for processing a set of rules in a ruleblock using policy evaluation.

The AblePolicyEngine processes AbleAssertionRules and AblePolicyRules and ignores all others.

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`, `AblePolicyRule`, Serialized Form

Nested Class Summary
`class` | `AblePolicyEngine.EligibleRuleListEntry_` This class is used to cache a rule with its current business value (priority) and an instance of this class becomes an element in a list of rules that are eligible to fire.

Field Summary

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

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

Method Summary
`java.lang.Object` | `getControlParameter(java.lang.String theControlParameter)` Gets the value of the specified control parameter.
`void` | `infer(AbleRuleBlock theRuleBlock)` Fires one rule in the specified ruleblock using policy rule inferencing.
`boolean` | `isRuleBlockValid(AbleRuleBlock theRuleBlock)` Determines whether the specified ruleblock is "executable" by examining the rule types and rule object configurations.
`protected void` | `logEligibleRuleList(java.util.Vector theEligibleRuleList)` Writes the contents of the eligible rule list (triggered rules) to the Inference trace log.
`void` | `setControlParameter(java.lang.String theControlParameter, java.lang.Object theValue)` Sets the value of the specified control parameter.

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

### AblePolicyEngine

    public AblePolicyEngine(AbleRuleSet theRuleSet,
                            AbleLogger theTracer)

  Create a new policy inference engine.

Parameters:
  `theRuleSet` - A ruleset whose rules are to be 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.

### AblePolicyEngine

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

  Create a new policy 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

### setControlParameter

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

  Sets the value of the specified control parameter. This engine accepts no control parameters.

  Specified by:
    `setControlParameter` in class `AbleInferenceEngine`
  Parameters:
    `theControlParameter` - The name of the control parameter to set. This engine accepts no control parameters.

    `theValue` - The value to be assigned to the specified control parameter.

  Throws:
    `AbleDataException` - If the specified control parameter is not supported by this engine.

### getControlParameter

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

  Gets the value of the specified control parameter. This engine contains no control parameters.

  Specified by:
    `getControlParameter` in class `AbleInferenceEngine`
  Parameters:
    `theControlParameter` - The name of the control parameter to get. This engine accepts no names.

  Returns:
    the current value of the specified control parameter.
  Throws:
    `AbleDataException` - If the specified control parameter is not supported by this engine.

### isRuleBlockValid

    public boolean isRuleBlockValid(AbleRuleBlock theRuleBlock)

  Determines whether the specified ruleblock is "executable" by examining the rule types and rule object configurations.

  This engine can process only "policy" rules; therefore, the specified ruleblock is invalid if any of the following are present:

  - IfThenElse rules
  - Predicate rules
  - Iteration rules
  - Pattern match rules

  Specified by:
    `isRuleBlockValid` in class `AbleInferenceEngine`
  Parameters:
    `theRuleBlock` - The rule block to be validated for use with this engine.

  Returns:
    true, if the ruleset is OK; false, if the ruleset is not executable. Furthermore, all reasons for validation failures are appended to the AbleRuleSet's myIsExReason variable.

### infer

    public void infer(AbleRuleBlock theRuleBlock)
               throws AbleDataException

  Fires one rule in the specified ruleblock using policy rule inferencing.

  The infer() method is called by the AbleRuleSet process() method as part of the overall ruleset bean processing sequence.

  The order of processing is as follows:

  1. Sequentially evaluate all assertion rules in declaration order.
  2. Evaluate all enabled policy rules, selecting those whose preconditions are true. Then fire the rule with the most important business value. If several eligible rules have the same "most important" business value, the first rule defined is fired.

  Specified by:
    `infer` in class `AbleInferenceEngine`
  Parameters:
    `theRuleBlock` - The ruleblock to be processed.

  Throws:
    `AbleDataException` - When any error occurs.

### logEligibleRuleList

    protected void logEligibleRuleList(java.util.Vector theEligibleRuleList)

  Writes the contents of the eligible rule list (triggered rules) to the Inference trace log. Assumes trace is active.

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