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 AbleRuleBlock

    java.lang.Object
      com.ibm.able.rules.AbleRuleBlock

All Implemented Interfaces:
  java.io.Serializable

Direct Known Subclasses:
  AbleRuleBlockInclude

public class AbleRuleBlock
extends java.lang.Object
implements java.io.Serializable

This class represents a named set of rules, an associated inference engine, and a return data type. Ruleblocks are used to partition rulesets into groups which are processed by an inference engine to produce some result.

There are several "special" ruleblocks with reserved names, such as init(), preProcess(), process(), postProcess(), handleTimerEvent(), handleAbleEvent(), catch(), and quitAll(). These ruleblocks are processed at specific times in the life of an AbleRuleSet bean.

Other named ruleblocks can be invoked using the invokeRuleBlock("key") built-in function, where "key" is the ruleblock's name+signature which can be obtained with the getRuleBlockKey() method. Ruleblocks can return no value (void) or they can return values to the caller using the returnFromRuleBlock(value) built-in function.

See Also:
  Serialized Form

Field Summary
`protected java.util.Vector` | `myAstRuleList` myAstRuleList is the sequence of assertion rules in this rule block.
`protected java.util.Vector` | `myCndRuleList` myCndRuleList is the sequence of conditional rules in this rule block.
`protected java.lang.String` | `myComment` "myComment" provides a place to associate a comment with this rule block.
`protected java.util.Hashtable` | `myControlParameterList` The parameters used to control the associated inference engine.
`protected java.util.Vector` | `myControlParameters`
`protected java.util.Vector` | `myCorrelationRuleList` myCorrelationRuleList is the sequence of event condition action rules in this rule block.
`protected java.lang.String` | `myEngineType` The type of inference engine to be used to evaluate the rules in this ruleblock.
`protected java.util.Vector` | `myFormalParameters`
`protected java.lang.String` | `myFormalSignature`
`protected java.util.Vector` | `myIfThenElseRuleList` myIfThenElseRuleList is the sequence of if (expr) then-else rules in this rule block.
`protected AbleInferenceEngine` | `myInferenceEngine` The inference engine associated with this ruleblock.
`protected java.util.Vector` | `myIterationRuleList` myIterationRuleList is the sequence of iteration rules in this rule block.
`protected java.lang.String` | `myName` myName is the unique name of this particular rule block; that is, each rule block within an AbleRuleSet must have a unique name.
`protected java.util.Vector` | `myPatternMatchRuleList` myPatternMatchRuleList is the sequence of pattern match rules in this rule block.
`protected java.util.Vector` | `myPlanningRuleList` myPlanningRuleList is the sequence of planning rules in this rule block.
`protected java.util.Vector` | `myPolicyRuleList` myPolicyRuleList is the sequence of policy rules in this rule block.
`protected java.util.Vector` | `myPredicateRuleList` myPredicateRuleList is the sequence of predicate facts and rules in this rule block.
`protected boolean` | `myProcessedFlag` myProcessedFlag indicates whether this rule block has been processed at least once.
`protected java.util.Map` | `myProperties` A collection of properties that the user can set and use in any manner desired.
`protected java.lang.String` | `myReturnType` The rule block return type (for example "String").
`protected java.lang.Object` | `myReturnValue` The return value from this ruleblock.
`protected java.lang.String` | `myRuleBlockKey`
`protected java.util.Vector` | `myRuleList` myRuleList is the sequence of all rules that make up this rule block.
`protected AbleRuleSet` | `myRuleSet` The parent ruleset.
`protected AbleLogger` | `myTrace` The inference engine trace logger.
`protected java.util.Vector` | `myTreeRuleList` myTreeRuleList is the sequence of tree rules in this rule block.
`protected java.util.Hashtable` | `myVariableList`
`protected java.util.Vector` | `myVariableOrder`
`static java.lang.String` | `RuleBlockCatch` Rule Block Name: catch().
`static java.lang.String` | `RuleBlockInit` Rule Block Name: init().
`static java.lang.String` | `RuleBlockPostProcess` Rule Block Name: postProcess().
`static java.lang.String` | `RuleBlockPreProcess` Rule Block Name: preProcess().
`static java.lang.String` | `RuleBlockProcess` Rule Block Name: process().
`static java.lang.String` | `RuleBlockProcessAbleEvent` Rule Block Name: processAbleEvent().
`static java.lang.String` | `RuleBlockProcessTimerEvent` Rule Block Name: processTimerEvent().
`static java.lang.String` | `RuleBlockQuitAll` Rule Block Name: quitAll().

Constructor Summary
`AbleRuleBlock(java.lang.String theName, AbleRuleSet theRuleSet, AbleLogger theLogger, java.lang.String theReturnType)` Deprecated. Use version with 'FormalSignature'.
`AbleRuleBlock(java.lang.String theName, AbleRuleSet theRuleSet, AbleLogger theLogger, java.lang.String theReturnType, java.lang.String theFormalSignature, java.util.Vector theFormalParameters, java.lang.String theEngineType, java.lang.String theComment, java.util.Map theProperties)` Create a new rule block with the specified characteristics.

Method Summary
`protected void` | `addAssertion(AbleAssertionRule theRule)` Add an assertion to the rule block.
`protected void` | `addConditionalRule(AbleConditionalRule theRule)` Add a conditional (if-then) rule to the rule block.
`protected void` | `addCorrelationRule(AbleCorrelationRule theRule)` Add an event correlation rule (event-condition-action) to the rule block.
`protected void` | `addIfThenElseRule(AbleIfThenElseRule theRule)` Add an if (expr) then-else rule to the rule block.
`protected void` | `addIterationRule(AbleIterationRule theRule)` Add an iteration rule (do/while, do/until, while/do, for-loop) to the rule block.
`protected void` | `addPatternMatchRule(AblePatternMatchRule theRule)` Add a pattern match (when-do) rule to the rule block.
`protected void` | `addPlanningRule(AblePlanningRule theRule)` Add an planning rule (preconditions-effects) to the rule block.
`protected void` | `addPolicyRule(AblePolicyRule theRule)` Add a policy rule to the rule block.
`protected void` | `addPredicateRule(AblePredicateRule theRule)` Add a predicate fact or rule to the rule block.
`protected void` | `addRule(AbleRule theRule)` Add an Able rule (any type) to the end of the rule block.
`AbleVariable` | `addRuleBlockVariable(java.lang.String theVariableName, java.lang.String theVariableType)` Create and add a variable local to this ruleblock
`protected void` | `addSwitchRule(AbleSwitchRule theRule)` Add a 'switch' rule to the rule block.
`protected void` | `addTreeRule(AbleTreeRule theRule)` Add a tree rule (decision tree/table) to the rule block.
`void` | `addVariable(AbleVariable theVariable)` Add a variable to the rule block.
`java.lang.String` | `arlString()` Return a formal Able Rule Language (ARL) String.
`java.lang.String` | `armlString()` Return a formal XML string.
`void` | `checkTimePeriodPreConditions(java.util.Calendar theCurrentTime)` Evaluate each rule in the ruleblock against the time period preconditions.
`java.lang.String` | `getArlComment()` Retrieve the comment associated with this ruleblock as an arl string enclosed in javadoc delimiters.
`java.util.Vector` | `getAssertions()` Retrieve the list of assertion rules.
`java.lang.String` | `getComment()` Retrieve the comment associated with this ruleblock.
`java.util.Vector` | `getConditionalRules()` Retrieve the list of conditional rules.
`java.lang.Object` | `getControlParameter(java.lang.String theControlParameter)` Returns a single control parameter on the associated inference engine.
`java.util.Hashtable` | `getControlParameters()` Retrieve the (possibly empty) set of parameters passed to the associated inference engine.
`java.util.Vector` | `getCorrelationRules()` Retrieve the list of event correlation rules.
`java.util.Vector` | `getEnabledAssertions()` Retrieve the list of enabled assertion rules.
`java.util.Vector` | `getEnabledConditionalRules()` Retrieve the list of enabled conditional rules.
`java.util.Vector` | `getEnabledCorrelationRules()` Retrieve the list of enabled correlation rules.
`java.util.Vector` | `getEnabledIfThenElseRules()` Retrieve the list of enabled if-then-else rules.
`java.util.Vector` | `getEnabledIterationRules()` Retrieve the list of enabled iteration rules.
`java.util.Vector` | `getEnabledPatternMatchRules()` Retrieve the list of enabled pattern match rules.
`java.util.Vector` | `getEnabledPlanningRules()` Retrieve the list of enabled planning rules.
`java.util.Vector` | `getEnabledPolicyRules()` Retrieve the list of enabled policy rules.
`java.util.Vector` | `getEnabledPredicateRules()` Retrieve the list of enabled predicate facts and rules.
`java.util.Vector` | `getEnabledRules()` Retrieve the list of all enabled rules.
`java.util.Vector` | `getEnabledTreeRules()` Retrieve the list of enabled tree rules.
`java.lang.String` | `getEngineType()` Retrieve the current engine type.
`java.util.Vector` | `getIfThenElseRules()` Retrieve the list of if-then-else rules.
`AbleInferenceEngine` | `getInferenceEngine()` Retrieve the rule block's inference engine.
`java.util.Vector` | `getIterationRules()` Retrieve the list of iteration rules.
`java.lang.String` | `getName()` Retrieve the rule block's name.
`java.util.Vector` | `getPatternMatchRules()` Retrieve the list of pattern match rules.
`java.util.Vector` | `getPlanningRules()` Retrieve the list of planning rules.
`java.util.Vector` | `getPolicyRules()` Retrieve the list of policy rules.
`java.util.Vector` | `getPredicateRules()` Retrieve the list of predicate facts and rules.
`java.util.Map` | `getProperties()` Returns a pointer to the entire current collection of properties.
`java.lang.String` | `getProperty(java.lang.String theName)` Gets the property associated with the specified name.
`java.lang.String` | `getReturnType()` Retrieve the return data type of this ruleblock.
`java.lang.Object` | `getReturnValue()` Retrieve the return value (if any) set on this ruleblock.
`AbleRule` | `getRule(java.lang.String theRuleLabel)` Retrieves a rule by name.
`java.lang.String` | `getRuleBlockKey()` Retrieve the rule block's unique key.
`java.util.Vector` | `getRules()` Retrieve the list of all rules.
`int` | `getRulesFiredCount()` Returns the number of rules fired by the associated inference engine during the last infer() call
`java.util.Vector` | `getRuleTemplates()` Retrieve all rule template objects defined in this ruleblock
`java.lang.String` | `getTemplateString(java.util.Vector theTemplateVars)` Retrieve a text format string for use by ruleset templates.
`java.util.Vector` | `getTemplateVars(AbleRuleSet theRuleSet)` Return a list of template vars referenced by this ruleblock.
`java.util.Vector` | `getTreeRules()` Retrieve the list of tree rules.
`AbleVariable` | `getVariable(java.lang.String theVariableName)` Retrieve a reference to a variable declared in the ruleblock.
`AbleWorkingMemory` | `getWorkingMemory()` Retrieve the working memory associated with the rule block's inference engine.
`void` | `init()` Initialize and configure the ruleblock by dynamically creating an instance of the specified inference engine.
`protected void` | `insertRuleAt(int theIndex, AbleRule theRule)` Insert an Able rule (any type) at specified position in the rule block.
`boolean` | `isProcessed()` Determine whether this rule block has been processed at least once.
`boolean` | `isRuleBlockVariable(java.lang.String theVariableName)` Determine, by name, whether a variable is local to this ruleblock.
`void` | `process()`
`void` | `processInputs(java.lang.Object[] theParameters)` Set the formal input parameter values prior to invoking the ruleblock.
`java.lang.String` | `removeProperty(java.lang.String theName)` Removes the property and the specified name from the collection of properties.
`protected void` | `removeRule(AbleRule theRule)` Remove an Able rule (any type) from the rule block.
`protected void` | `replaceLabeledRule(java.lang.String theRuleLabel, AbleRule theNewRule)` Replace a labeled rule (any type) in the rule block at its current position in the rule block.
`protected void` | `replaceRule(AbleRule theOldRule, AbleRule theNewRule)` Replace an Able rule (any type) in the rule block at its current position in the ruleblock.
`static boolean` | `reservedRuleBlock(java.lang.String theRuleBlockName)` Determines whether the specified rule block name, without signature, is the name of a reserved rule block, such as "preProcess", "process", "catch", and so on.
`void` | `reset()` Reset the rule block so that rules can be fired again: all rules are set to their original state.
`void` | `setComment(java.lang.String theComment)` Set (or change) the comment associated with this ruleblock.
`void` | `setControlParameter(java.lang.String theControlParameter, java.lang.Object theValue)` Set a single control parameter on the associated inference engine.
`void` | `setControlParameters(java.util.Hashtable theControlParameters)` Set the (possibly empty) set of parameters passed to the associated inference engine.
`void` | `setDebugLevel(int theDebugLevel)` Set the debug level on the associated inference engine.
`void` | `setEngineType(java.lang.String theEngineType)` Set the type of the inference engine to be used by this ruleblock.
`void` | `setFormalParameters(java.util.Vector theFormalParameters)` Set the list of formal parameters for this ruleblock.
`void` | `setProcessed(boolean theProcessedFlag)` Set the flag that indicates whether this rule block has been processed at least once.
`void` | `setProperties(java.util.Map theProperties)` Sets the entire collection of properties to the specified collection.
`void` | `setProperty(java.lang.String theName, java.lang.String theValue)` Sets the specified property to the specified value.
`void` | `setReturnValue(java.lang.Object theReturnValue)` Set the return value for this ruleblock.
`java.lang.String` | `toString()` Retrieve a string describing (the contents of) the object.
`java.lang.String` | `traceString(int theTraceStringFlavor)` Retrieve a string describing (the contents of) the object.
`java.lang.String` | `xmlString()` Return a formal XML string.

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

Field Detail

### RuleBlockInit

    public static final java.lang.String RuleBlockInit

  Rule Block Name: init().

  The "init" rule block is processed once when the AbleRuleSet init() method is invoked.

  See Also:
    Constant Field Values

### RuleBlockProcess

    public static final java.lang.String RuleBlockProcess

  Rule Block Name: process().

  The "process" rule block is meant to be processed multiple times, once for each "process" cycle, and it is meant to be processed by a specialized inference engine, such as a fuzzy logic inference engine or a bollean forward chainer. The rules are processed in an order determined by the inference engine.

  See Also:
    Constant Field Values

### RuleBlockPreProcess

    public static final java.lang.String RuleBlockPreProcess

  Rule Block Name: preProcess().

  The "preProcess" rule block is meant to be called before the process() rule block is called.

  See Also:
    Constant Field Values

### RuleBlockPostProcess

    public static final java.lang.String RuleBlockPostProcess

  Rule Block Name: postProcess().

  The "postProcess" rule block is meant to be processed each time processing of the process() rule block quiesces.

  See Also:
    Constant Field Values

### RuleBlockCatch

    public static final java.lang.String RuleBlockCatch

  Rule Block Name: catch().

  The "catch" rule block is called to handle exceptions that are thrown during the evaluation of the process() method.

  See Also:
    Constant Field Values

### RuleBlockQuitAll

    public static final java.lang.String RuleBlockQuitAll

  Rule Block Name: quitAll().

  The "finally" rule block is called when the bean quitAll() method is invoked.

  See Also:
    Constant Field Values

### RuleBlockProcessTimerEvent

    public static final java.lang.String RuleBlockProcessTimerEvent

  Rule Block Name: processTimerEvent().

  The "processTimerEvent" rule block is called to process timer events generated by the ruleset bean.

  See Also:
    Constant Field Values

### RuleBlockProcessAbleEvent

    public static final java.lang.String RuleBlockProcessAbleEvent

  Rule Block Name: processAbleEvent().

  The "processAbleEvent" rule block is called to process able events received by the ruleset bean due to a handleAbleEvent() (or processAbleEvent()) method invocation. The rules can access the event object via the "event" built-in variable.

  See Also:
    Constant Field Values

### myName

    protected java.lang.String myName

  myName is the unique name of this particular rule block; that is, each rule block within an AbleRuleSet must have a unique name.

### myInferenceEngine

    protected AbleInferenceEngine myInferenceEngine

  The inference engine associated with this ruleblock.

### myRuleList

    protected java.util.Vector myRuleList

  myRuleList is the sequence of all rules that make up this rule block. The rules are in order of addition to this rule block.

### myAstRuleList

    protected java.util.Vector myAstRuleList

  myAstRuleList is the sequence of assertion rules in this rule block. It is a subset of myRuleList.

### myCndRuleList

    protected java.util.Vector myCndRuleList

  myCndRuleList is the sequence of conditional rules in this rule block. It is a subset of myRuleList.

### myIfThenElseRuleList

    protected java.util.Vector myIfThenElseRuleList

  myIfThenElseRuleList is the sequence of if (expr) then-else rules in this rule block. It is a subset of myRuleList.

### myPolicyRuleList

    protected java.util.Vector myPolicyRuleList

  myPolicyRuleList is the sequence of policy rules in this rule block. It is a subset of myRuleList.

### myPatternMatchRuleList

    protected java.util.Vector myPatternMatchRuleList

  myPatternMatchRuleList is the sequence of pattern match rules in this rule block. It is a subset of myRuleList.

### myPredicateRuleList

    protected java.util.Vector myPredicateRuleList

  myPredicateRuleList is the sequence of predicate facts and rules in this rule block. It is a subset of myRuleList.

### myIterationRuleList

    protected java.util.Vector myIterationRuleList

  myIterationRuleList is the sequence of iteration rules in this rule block. It is a subset of myRuleList.

### myCorrelationRuleList

    protected java.util.Vector myCorrelationRuleList

  myCorrelationRuleList is the sequence of event condition action rules in this rule block. It is a subset of myRuleList.

### myPlanningRuleList

    protected java.util.Vector myPlanningRuleList

  myPlanningRuleList is the sequence of planning rules in this rule block. It is a subset of myRuleList.

### myTreeRuleList

    protected java.util.Vector myTreeRuleList

  myTreeRuleList is the sequence of tree rules in this rule block. It is a subset of myRuleList.

### myProcessedFlag

    protected boolean myProcessedFlag

  myProcessedFlag indicates whether this rule block has been processed at least once. The flag is initialized to false, but is not otherwise maintained by the rule block. The flag must be maintained by processing code, an inference engine, for example, that is interested in keeping track of whether a rule block might have been previously processed. This flag and its associated methods make it possible to implement an "init" type of rule block that is processed just once at initialization time.

  This flag is not reset by the reset() method.

### myEngineType

    protected java.lang.String myEngineType

  The type of inference engine to be used to evaluate the rules in this ruleblock.

### myRuleSet

    protected AbleRuleSet myRuleSet

  The parent ruleset.

### myTrace

    protected AbleLogger myTrace

  The inference engine trace logger.

### myControlParameterList

    protected java.util.Hashtable myControlParameterList

  The parameters used to control the associated inference engine.

### myControlParameters

    protected java.util.Vector myControlParameters

### myReturnType

    protected java.lang.String myReturnType

  The rule block return type (for example "String").

### myReturnValue

    protected java.lang.Object myReturnValue

  The return value from this ruleblock. Reset to null on entry, only set if user codes a return() statement.

### myComment

    protected java.lang.String myComment

  "myComment" provides a place to associate a comment with this rule block. The value is initialized to the empty String ("") and is never expected to be null.

  See Also:
    `setComment(String)`, `getComment()`

### myVariableList

    protected java.util.Hashtable myVariableList

### myVariableOrder

    protected java.util.Vector myVariableOrder

### myFormalParameters

    protected java.util.Vector myFormalParameters

### myFormalSignature

    protected java.lang.String myFormalSignature

### myRuleBlockKey

    protected java.lang.String myRuleBlockKey

### myProperties

    protected java.util.Map myProperties

  A collection of properties that the user can set and use in any manner desired.

  The default underlying data type is java.util.Hashtable, selected because its methods are synchronized. If synchronization isn't an issue, use `setProperties(Map)` to set the member to some other data type.

  The member must never be null.

  Property change events are not fired for changes to this member.

  Since:
    2.2.0
  See Also:
    `setProperty(String,String)`, `getProperty(String)`, `setProperties(Map)`, `getProperties()`

Constructor Detail

### AbleRuleBlock

    public AbleRuleBlock(java.lang.String theName,
                         AbleRuleSet theRuleSet,
                         AbleLogger theLogger,
                         java.lang.String theReturnType)

  Deprecated. Use version with 'FormalSignature'.

  Create a new rule block with the specified name.

Parameters:
  `theName` - The unique name of this rule block.

### AbleRuleBlock

    public AbleRuleBlock(java.lang.String theName,
                         AbleRuleSet theRuleSet,
                         AbleLogger theLogger,
                         java.lang.String theReturnType,
                         java.lang.String theFormalSignature,
                         java.util.Vector theFormalParameters,
                         java.lang.String theEngineType,
                         java.lang.String theComment,
                         java.util.Map theProperties)

  Create a new rule block with the specified characteristics.

Parameters:
  `theName` - The name of the rule block being created. The name does not need to be unique, but the name and the formal signature must be unique.
  `theRuleSet` - The ruleset that defines the context in which this rule block will be evaluated.
  `theLogger` - A place to log messages.
  `theReturnType` - The data type that this rule block returns; for example, "String". If the rule block does not return anything, use "void".
  `theFormalSignature` - The signature of this rule block; for example, if the rule block takes a String, a Boolean, and a Double as parameters, the signature must be `"(String,Boolean,Double)"`. If the rule block takes no parameters, use `"()"`.
  `theFormalParameters` - If the rule block takes parameters, this is a list of references to those parameters, which are AbleVariable objects. If the rule block takes no parameters, this must be an empty Vector. This parameter must never be null.
  `theEngineType` - The data type of the inference engine that will process this rule block.
  `theComment` - A comment for this rule block. The comment should not contain the `"\/**"` and `"*\/"` javadoc delimiters.
  `theProperties` - A set of properties for the rule block. Each key must be a String, and each value must be a String.
Since:
  ABLE 2.2.0

Method Detail

### reservedRuleBlock

    public static final boolean reservedRuleBlock(java.lang.String theRuleBlockName)

  Determines whether the specified rule block name, without signature, is the name of a reserved rule block, such as "preProcess", "process", "catch", and so on. Case is ignored.

  Parameters:
    `theRuleBlockName` - A name to be checked against the list of reserved rule block names. Since all reserved rule blocks take zero arguments, "()" is appended to this name before the check occurs. For the purposes of this function, "process()" is the same as "PROCESS()".
  Returns:
    true if the specified rule block name is a reserved rule block name; false otherwise.
  Since:
    ABLE 2.2.0

### init

    public void init()
              throws AbleException,
                     AbleParException,
                     AbleDataException

  Initialize and configure the ruleblock by dynamically creating an instance of the specified inference engine.

  Throws:
    `AbleException`
    `AbleParException`
    `AbleDataException`

### process

    public void process()
                 throws AbleDataException

  Throws:
    `AbleDataException`

### checkTimePeriodPreConditions

    public final void checkTimePeriodPreConditions(java.util.Calendar theCurrentTime)
                                            throws AbleDataException

  Evaluate each rule in the ruleblock against the time period preconditions. If the rule is active, make sure it is enabled.

  Throws:
    `AbleDataException`

### setDebugLevel

    public final void setDebugLevel(int theDebugLevel)

  Set the debug level on the associated inference engine.

### getControlParameters

    public java.util.Hashtable getControlParameters()

  Retrieve the (possibly empty) set of parameters passed to the associated inference engine.

### setControlParameters

    public void setControlParameters(java.util.Hashtable theControlParameters)
                              throws AbleDataException

  Set the (possibly empty) set of parameters passed to the associated inference engine.

  Throws:
    `AbleDataException`

### setControlParameter

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

  Set a single control parameter on the associated inference engine.

  Throws:
    `AbleDataException`

### getControlParameter

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

  Returns a single control parameter on the associated inference engine.

  Throws:
    `AbleDataException`

### setReturnValue

    public void setReturnValue(java.lang.Object theReturnValue)

  Set the return value for this ruleblock.

### getReturnValue

    public java.lang.Object getReturnValue()

  Retrieve the return value (if any) set on this ruleblock.

### getReturnType

    public java.lang.String getReturnType()

  Retrieve the return data type of this ruleblock.

### getName

    public java.lang.String getName()

  Retrieve the rule block's name.

  As of ABLE 2.2.0 the ruleblock name itself is no longer unique. There may be multiple rule blocks with the same name, but different signatures. The rule block's key, comprised of name and signature, is what makes a rule block uniquely identifiable.

  Returns:
    The name of the rule block.

### getRuleBlockKey

    public java.lang.String getRuleBlockKey()

  Retrieve the rule block's unique key.

  Returns:
    The unique key of the rule block.
  Since:
    ABLE 2.2.0

### setComment

    public void setComment(java.lang.String theComment)

  Set (or change) the comment associated with this ruleblock.

  Parameters:
    `theComment` - A String containing the new comment for this ruleblock. This comment replaces the current comment.

  See Also:
    `myComment`

### getComment

    public java.lang.String getComment()

  Retrieve the comment associated with this ruleblock.

  Returns:
    A String containing the current comment associated with this ruleblock or the empty string if no comment has been set. The value is never expected to be null.
  See Also:
    `myComment`

### getArlComment

    public java.lang.String getArlComment()

  Retrieve the comment associated with this ruleblock as an arl string enclosed in javadoc delimiters.

  Any properties associated with this object are placed into the comment using `@prop` tags.

  Returns:
    A String containing the current comment associated with this ruleblock or the empty string if no comment has been set. The value is never expected to be null.
  See Also:
    `myComment`

### getInferenceEngine

    public AbleInferenceEngine getInferenceEngine()

  Retrieve the rule block's inference engine.

  Returns:
    The inference engine of the rule block.

### getWorkingMemory

    public AbleWorkingMemory getWorkingMemory()

  Retrieve the working memory associated with the rule block's inference engine.

  Returns:
    The working memory used by the inference engine of the rule block.

### setEngineType

    public void setEngineType(java.lang.String theEngineType)

  Set the type of the inference engine to be used by this ruleblock. Note: the name must be registered with the AbleRuleSet and the engine class must be accessible via the CLASSPATH.

### getEngineType

    public final java.lang.String getEngineType()

  Retrieve the current engine type. Engine types are enumerated in the `AbleRuleSet` class.

  Returns:
    The current inference engine type.
  See Also:
    `setEngineType(java.lang.String)`

### addAssertion

    protected void addAssertion(AbleAssertionRule theRule)

  Add an assertion to the rule block.

  Parameters:
    `theRule` - The assertion to add.

### addConditionalRule

    protected void addConditionalRule(AbleConditionalRule theRule)

  Add a conditional (if-then) rule to the rule block.

  Parameters:
    `theRule` - The conditional rule to add.

### addIfThenElseRule

    protected void addIfThenElseRule(AbleIfThenElseRule theRule)

  Add an if (expr) then-else rule to the rule block.

  Parameters:
    `theRule` - The if-then-else rule to add.

### addPolicyRule

    protected void addPolicyRule(AblePolicyRule theRule)

  Add a policy rule to the rule block.

  Parameters:
    `theRule` - The policy rule to add.

### addPatternMatchRule

    protected void addPatternMatchRule(AblePatternMatchRule theRule)

  Add a pattern match (when-do) rule to the rule block.

  Parameters:
    `theRule` - The pattern match rule to add.

### addPredicateRule

    protected void addPredicateRule(AblePredicateRule theRule)

  Add a predicate fact or rule to the rule block.

  Parameters:
    `theRule` - The predicate fact or rule to add.

### addIterationRule

    protected void addIterationRule(AbleIterationRule theRule)

  Add an iteration rule (do/while, do/until, while/do, for-loop) to the rule block.

  Parameters:
    `theRule` - The rule to add.

### addCorrelationRule

    protected void addCorrelationRule(AbleCorrelationRule theRule)

  Add an event correlation rule (event-condition-action) to the rule block.

  Parameters:
    `theRule` - The rule to add.

### addPlanningRule

    protected void addPlanningRule(AblePlanningRule theRule)

  Add an planning rule (preconditions-effects) to the rule block.

  Parameters:
    `theRule` - The rule to add.

### addTreeRule

    protected void addTreeRule(AbleTreeRule theRule)

  Add a tree rule (decision tree/table) to the rule block.

  Parameters:
    `theRule` - The rule to add.

### addSwitchRule

    protected void addSwitchRule(AbleSwitchRule theRule)

  Add a 'switch' rule to the rule block.

  Parameters:
    `theRule` - The rule to add.

### addRule

    protected void addRule(AbleRule theRule)

  Add an Able rule (any type) to the end of the rule block.

  Parameters:
    `theRule` - The rule to add.

### insertRuleAt

    protected void insertRuleAt(int theIndex,
                                AbleRule theRule)

  Insert an Able rule (any type) at specified position in the rule block.

  Parameters:
    `theRule` - The rule to add.
    `theIndex` - the integer position or index where the rule should be inserted (0-based)

### removeRule

    protected void removeRule(AbleRule theRule)

  Remove an Able rule (any type) from the rule block.

  Parameters:
    `theRule` - The rule to remove.

### replaceRule

    protected void replaceRule(AbleRule theOldRule,
                               AbleRule theNewRule)

  Replace an Able rule (any type) in the rule block at its current position in the ruleblock. Note the oldRule and newRule could be of different types.

  Parameters:
    `theOldRule` - The rule to be replaced.
    `theNewRule` - The rule to be used henceforth.

### replaceLabeledRule

    protected void replaceLabeledRule(java.lang.String theRuleLabel,
                                      AbleRule theNewRule)

  Replace a labeled rule (any type) in the rule block at its current position in the rule block. Note that the oldRule and the newRule can be of different types.

  Parameters:
    `theRuleLabel` - The label of rule to be replaced.
    `theNewRule` - The replacement rule.
  Since:
    ABLE 2.2.0

### getRule

    public final AbleRule getRule(java.lang.String theRuleLabel)

  Retrieves a rule by name.

  Parameters:
    `theRuleLabel` - The name or label of the desired rule.

  Returns:
    The specified rule, or null if the rule does not exist.
  Since:
    ABLE 2.2.0

### getRules

    public java.util.Vector getRules()

  Retrieve the list of all rules.

  Returns:
    A list of all rules (both assertions and conditional rules) defined in this rule block. The rules are in the order in which they were added.

### getEnabledRules

    public java.util.Vector getEnabledRules()

  Retrieve the list of all enabled rules. Template rules are not included in this list.

  Returns:
    A cloned list of all enabled rules (regardless of type) defined in this rule block. The rules are in the order in which they were added.

### getAssertions

    public java.util.Vector getAssertions()

  Retrieve the list of assertion rules.

  Returns:
    A list of assertion rules defined in this rule block, in declaration order.

### getEnabledAssertions

    public java.util.Vector getEnabledAssertions()

  Retrieve the list of enabled assertion rules. Template rules are not included in this list.

  Returns:
    A cloned list of enabled assertion rules defined in this rule block, in declaration order.

### getConditionalRules

    public java.util.Vector getConditionalRules()

  Retrieve the list of conditional rules.

  Returns:
    A list of conditional rules defined in this rule block, in declaration order.

### getEnabledConditionalRules

    public java.util.Vector getEnabledConditionalRules()

  Retrieve the list of enabled conditional rules. Template rules are not included in this list.

  Returns:
    A cloned list of enabled conditional rules defined in this rule block, in declaration order.

### getIfThenElseRules

    public java.util.Vector getIfThenElseRules()

  Retrieve the list of if-then-else rules.

  Returns:
    A list of if-then-else rules defined in this rule block, in declaration order.

### getEnabledIfThenElseRules

    public java.util.Vector getEnabledIfThenElseRules()

  Retrieve the list of enabled if-then-else rules. Template rules are not included in this list.

  Returns:
    A cloned list of enabled if-then-else rules defined in this rule block, in declaration order.

### getPolicyRules

    public java.util.Vector getPolicyRules()

  Retrieve the list of policy rules.

  Returns:
    A list of policy rules defined in this rule block, in declaration order.

### getEnabledPolicyRules

    public java.util.Vector getEnabledPolicyRules()

  Retrieve the list of enabled policy rules. Template rules are not included in this list.

  Returns:
    A cloned list of enabled policy rules defined in this rule block, in declaration order.

### getPatternMatchRules

    public java.util.Vector getPatternMatchRules()

  Retrieve the list of pattern match rules.

  Returns:
    A list of pattern match rules defined in this rule block, in declaration order.

### getEnabledPatternMatchRules

    public java.util.Vector getEnabledPatternMatchRules()

  Retrieve the list of enabled pattern match rules. Template rules are not included in this list.

  Returns:
    A cloned list of enabled pattern match rules defined in this rule block, in declaration order.

### getPredicateRules

    public java.util.Vector getPredicateRules()

  Retrieve the list of predicate facts and rules.

  Returns:
    A list of predicate facts and rules defined in this rule block, in declaration order.

### getEnabledPredicateRules

    public java.util.Vector getEnabledPredicateRules()

  Retrieve the list of enabled predicate facts and rules. Template rules are not included in this list.

  Returns:
    A cloned list of enabled predicate facts and rules defined in this rule block, in declaration order.

### getIterationRules

    public java.util.Vector getIterationRules()

  Retrieve the list of iteration rules.

  Returns:
    A list of iteration rules defined in this rule block, in declaration order.

### getEnabledIterationRules

    public java.util.Vector getEnabledIterationRules()

  Retrieve the list of enabled iteration rules. Template rules are not included in this list.

  Returns:
    A cloned list of enabled iteration rules defined in this rule block, in declaration order.

### getCorrelationRules

    public java.util.Vector getCorrelationRules()

  Retrieve the list of event correlation rules.

  Returns:
    A list of correlation rules defined in this rule block, in declaration order.

### getEnabledCorrelationRules

    public java.util.Vector getEnabledCorrelationRules()

  Retrieve the list of enabled correlation rules. Template rules are not included in this list.

  Returns:
    A cloned list of enabled correlation rules defined in this rule block, in declaration order.

### getPlanningRules

    public java.util.Vector getPlanningRules()

  Retrieve the list of planning rules.

  Returns:
    A list of planning rules defined in this rule block, in declaration order.

### getEnabledPlanningRules

    public java.util.Vector getEnabledPlanningRules()

  Retrieve the list of enabled planning rules. Template rules are not included in this list.

  Returns:
    A cloned list of enabled planning rules defined in this rule block, in declaration order.

### getTreeRules

    public java.util.Vector getTreeRules()

  Retrieve the list of tree rules.

  Returns:
    A list of tree rules defined in this rule block, in declaration order.

### getEnabledTreeRules

    public java.util.Vector getEnabledTreeRules()

  Retrieve the list of enabled tree rules. Template rules are not included in this list.

  Returns:
    A cloned list of enabled tree rules defined in this rule block, in declaration order.

### arlString

    public java.lang.String arlString()

  Return a formal Able Rule Language (ARL) String.

  Returns:
    A String describing the object in able rule language.

### xmlString

    public java.lang.String xmlString()

  Return a formal XML string.

  Returns:
    A String describing the object in XML.

### armlString

    public java.lang.String armlString()

  Return a formal XML string.

  Returns:
    A String describing the object in XML.

### reset

    public void reset()

  Reset the rule block so that rules can be fired again: all rules are set to their original state. Note that the "processed" flag is not reset. Must be called after init()

### setProcessed

    public void setProcessed(boolean theProcessedFlag)

  Set the flag that indicates whether this rule block has been processed at least once.

  Parameters:
    `theProcessedFlag` - Use true to indicate that the rules in this rule block have been processed at least once; use false otherwise.

### isProcessed

    public boolean isProcessed()

  Determine whether this rule block has been processed at least once.

  Returns:
    true if the rule block has been processed at least once; false otherwise.

### getRuleTemplates

    public java.util.Vector getRuleTemplates()
                                      throws AbleDataException

  Retrieve all rule template objects defined in this ruleblock

  Returns:
    A vector of all rule templates
  Throws:
    `AbleDataException`

### getTemplateString

    public java.lang.String getTemplateString(java.util.Vector theTemplateVars)
                                       throws AbleDataException

  Retrieve a text format string for use by ruleset templates. The string contains "{n}" strings, where the index 'n' corresponds to the template variables defined in the ruleset template. This string is based on the standard arlString() representation of the ruleblock. After replacement of the template variable values, the resulting string must be a valid ARL format string that can be parsed.

  Parameters:
    `theTemplateVars` - An ordered list of template variables referenced by this ruleblock.
  Returns:
    A Text format string used to create a new ruleblock instance.
  Throws:
    `AbleDataException`
  See Also:
    `AbleRuleTemplate`

### getTemplateVars

    public java.util.Vector getTemplateVars(AbleRuleSet theRuleSet)
                                     throws AbleDataException

  Return a list of template vars referenced by this ruleblock.

  Throws:
    `AbleDataException`

### getRulesFiredCount

    public int getRulesFiredCount()

  Returns the number of rules fired by the associated inference engine during the last infer() call

### setFormalParameters

    public void setFormalParameters(java.util.Vector theFormalParameters)

  Set the list of formal parameters for this ruleblock. When this ruleblock is invoked an Object[] of the correct size and types must be passed as an argument. The formal signature is also computed from the parameters

  Parameters:
    `theFormalParameters` -

### processInputs

    public void processInputs(java.lang.Object[] theParameters)
                       throws AbleDataException

  Set the formal input parameter values prior to invoking the ruleblock. These must be AbleRd objects (AbleLiterals or AbleVariables).

  Parameters:
    `theParameters` -
  Throws:
    `AbleDataException`

### addRuleBlockVariable

    public AbleVariable addRuleBlockVariable(java.lang.String theVariableName,
                                             java.lang.String theVariableType)
                                      throws AbleParException

  Create and add a variable local to this ruleblock

  Parameters:
    `theVariableName` -
    `theVariableType` -
  Returns:
    A local variable scoped to this ruleblock
  Throws:
    `AbleParException`

### isRuleBlockVariable

    public boolean isRuleBlockVariable(java.lang.String theVariableName)

  Determine, by name, whether a variable is local to this ruleblock.

  Parameters:
    `theVariableName` -
  Returns:
    true is the named variable is local to this rule block; false otherwise.
  Since:
    ABLE 2.2.0

### addVariable

    public void addVariable(AbleVariable theVariable)
                     throws AbleParException

  Add a variable to the rule block.

  Note: There are side effects on the specified variable:

  - the variable's ID is set to be a unique ID within this ruleset
  - the variable's context is set to be the ruleset
  - the variable's references object is set to be a new AbleClauseReferences object

  Parameters:
    `theVariable` - The variable to add.

  Throws:
    `AbleParException` - If a variable with the specified name already exists in this ruleblock.

### getVariable

    public AbleVariable getVariable(java.lang.String theVariableName)

  Retrieve a reference to a variable declared in the ruleblock.

  Parameters:
    `theVariableName` - The name of the variable to retrieve.

  Returns:
    A reference to the named variable or null if the variable does not exist.

### setProperty

    public void setProperty(java.lang.String theName,
                            java.lang.String theValue)

  Sets the specified property to the specified value.

  Parameters:
    `theName` - The name of the property to be placed into the collection of properties.
    `theValue` - The value associated with the specified property.
  Since:
    2.2.0

### getProperty

    public java.lang.String getProperty(java.lang.String theName)

  Gets the property associated with the specified name.

  Parameters:
    `theName` - The name of the property to be returned.
  Returns:
    The value associated with the specified name, or null if no property has been set for the specified name.
  Since:
    2.2.0

### removeProperty

    public java.lang.String removeProperty(java.lang.String theName)

  Removes the property and the specified name from the collection of properties.

  Parameters:
    `theName` - The name of the property to be removed.
  Returns:
    The value associated with the specified name, or null if no property has been set for the specified name.
  Since:
    2.2.0

### setProperties

    public void setProperties(java.util.Map theProperties)

  Sets the entire collection of properties to the specified collection.

  Parameters:
    `theProperties` - The set of properties that will replace the current collection of properties. If this parameter is specified as null, the call is ignored; that is, the underlying data member is not changed. Otherwise, the underlying data member is changed to point to the specified collection.

    Keys and values of the properties collection must be confined to the String data type.

  Since:
    2.2.0

### getProperties

    public java.util.Map getProperties()

  Returns a pointer to the entire current collection of properties.

  Returns:
    The entire current collection of properties.
  Since:
    2.2.0

### toString

    public java.lang.String toString()

  Retrieve a string describing (the contents of) the object.

  Returns:
    A String containing the current contents of the object.

### traceString

    public java.lang.String traceString(int theTraceStringFlavor)

  Retrieve a string describing (the contents of) the object.

  Parameters:
    `theTraceStringFlavor` - An Able.TraceStringFlavor value.

  Returns:
    A String containing the current contents of the object.

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