ABLE 2.3.0 07/13/2005 14:21:00

com.ibm.able.rules
Class AbleTreeRule

java.lang.Object
  extended bycom.ibm.able.rules.AbleRule
      extended bycom.ibm.able.rules.AbleTreeRule
All Implemented Interfaces:
java.io.Serializable

public class AbleTreeRule
extends AbleRule
implements java.io.Serializable

This class represents a decision tree or table (represented as a tree) rule, containing a DecisionTree object. DecisionTree rules are used by the DecisionTree engine.

See Also:
Serialized Form

Field Summary
protected  java.util.Vector myActionList
          myActionList is a list of AbleConsequentClause objects generated from the action nodes of the decision tree.
protected  AbleTree myDecisionTree
          myAntecedents is a list of AbleAntecedentClause objects.
protected  java.util.Vector myExpressionList
          myExpressionList is a list of AbleExpression objects generated from the condition nodes decision tree.
protected  java.util.Vector myRuleList
           
 
Fields inherited from class com.ibm.able.rules.AbleRule
myBooleanTruth, myBreakpoint, myComment, myEnabled, myFinalFlag, myFiredCount, myFiredFlag, myId, myLabel, myLocation, myPreConditions, myPriority, myPrompt, myProperties, myRdRefs, myRuleBlock, myRuleSet, myTemplateFlag, myTemplateName, myTemplateValues, myWrRefs, PriorityDefault, RuleIdInitial
 
Constructor Summary
AbleTreeRule(java.lang.String theLabel, AbleRd thePriority, AbleTree theDecisionTree, AbleRuleSet theRuleSet, AbleRuleBlock theRuleBlock)
          Create a new decision tree rule with the specified priority, and tree structure.
 
Method Summary
 java.lang.String arlString()
          Return a formal Able Rule Language (ARL) String.
 java.lang.String armlString()
          Return a formal XML string.
 java.util.Vector convertToAbleRules()
           
 AbleExpression createAbleExpression(java.util.Vector theExpressionList)
          Take an array of Expressions and construct a single conjunction AbleExpression
 boolean eval(AbleTreeNode theRootNode)
          Evaluate the decision tree structure directly via depth-first search of the tree
 AbleTree getDecisionTree()
          Retrieve the rule's decision tree.
 java.util.Vector getExpressionList()
          Retrieve the rule's list of expressions.
 java.util.Vector getRuleList()
          Return the set of AbleConditionalRules that represents this decision tree or table.
 java.lang.String getTemplateString(java.util.Vector theTemplateVars)
          Retrieve a text format string for use by rule templates.
 java.util.Vector getTemplateVars(AbleRuleSet theRuleSet)
          Return a list of template vars referenced by this rule.
 void reset()
          Reset the rule to its unfired state.
 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 com.ibm.able.rules.AbleRule
addHeaderRdReferences, addRdReference, addRdReferences, addWrReference, addWrReferences, arlActionBlockString, arlPreConditionsString, armlPreConditionsString, armlPriorityString, armlPropertiesString, checkTimePeriodPreConditions, clearBreakpoint, getArlComment, getBooleanTruth, getBreakpoint, getComment, getId, getIdLabelString, getLabel, getLocation, getMetaData, getPreConditions, getPriority, getPrompt, getPromptString, getProperties, getProperty, getRdReferences, getTemplateActionBlockString, getTemplateHeaderString, getTemplateName, getTemplateValues, getWrReferences, isDefaultPriority, isEnabled, isFinal, isFired, isGeneratedFromTemplate, isTemplate, logTrace, removeProperty, setBooleanTruth, setBreakpoint, setComment, setEnabled, setFinal, setFired, setId, setLocation, setMetaData, setPreConditions, setPriority, setPrompt, setProperties, setProperty, setTemplate, setTemplateName, setTemplateValues, xmlPreConditionsString, xmlPriorityString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

myDecisionTree

protected AbleTree myDecisionTree
myAntecedents is a list of AbleAntecedentClause objects.


myRuleList

protected java.util.Vector myRuleList

myExpressionList

protected java.util.Vector myExpressionList
myExpressionList is a list of AbleExpression objects generated from the condition nodes decision tree.


myActionList

protected java.util.Vector myActionList
myActionList is a list of AbleConsequentClause objects generated from the action nodes of the decision tree.

Constructor Detail

AbleTreeRule

public AbleTreeRule(java.lang.String theLabel,
                    AbleRd thePriority,
                    AbleTree theDecisionTree,
                    AbleRuleSet theRuleSet,
                    AbleRuleBlock theRuleBlock)
Create a new decision tree rule with the specified priority, and tree structure.

Parameters:
theLabel - The unique label, or name, of this rule.

thePriority - The priority of this rule.

theDecisionTree - A decision tree or table represented as a tree structure.

theRuleSet - The ruleset that defines the global context for this rule.

theRuleBlock - The ruleblock that defines the local context for this rule.

Method Detail

getDecisionTree

public final AbleTree getDecisionTree()
Retrieve the rule's decision tree.

Returns:
The decision tree structure.

getExpressionList

public final java.util.Vector getExpressionList()
Retrieve the rule's list of expressions.

Returns:
The expressions of the rule.

getRuleList

public final java.util.Vector getRuleList()
Return the set of AbleConditionalRules that represents this decision tree or table.

Returns:
The rule list.

reset

public void reset()
Reset the rule to its unfired state. Clear all antecedent clause truthValues.

Overrides:
reset in class AbleRule

convertToAbleRules

public java.util.Vector convertToAbleRules()

createAbleExpression

public AbleExpression createAbleExpression(java.util.Vector theExpressionList)
Take an array of Expressions and construct a single conjunction AbleExpression

Parameters:
theExpressionList - A vector of AbleExpressions

eval

public boolean eval(AbleTreeNode theRootNode)
             throws AbleDataException
Evaluate the decision tree structure directly via depth-first search of the tree

Throws:
AbleDataException

arlString

public java.lang.String arlString()
Return a formal Able Rule Language (ARL) String.

Specified by:
arlString in class AbleRule
Returns:
A String describing the object in Able rule language.

xmlString

public java.lang.String xmlString()
Return a formal XML string.

Specified by:
xmlString in class AbleRule
Returns:
A String describing the object in XML.

armlString

public java.lang.String armlString()
Return a formal XML string.

Specified by:
armlString in class AbleRule
Returns:
A String describing the object in XML.

getTemplateVars

public java.util.Vector getTemplateVars(AbleRuleSet theRuleSet)
                                 throws AbleDataException
Return a list of template vars referenced by this rule. This overrides base AbleRule implementation to handle case where template vars are referenced in the then part of the rule

Overrides:
getTemplateVars in class AbleRule
Throws:
AbleDataException

getTemplateString

public java.lang.String getTemplateString(java.util.Vector theTemplateVars)
                                   throws AbleDataException
Retrieve a text format string for use by rule templates. The string contains "{n}" strings, where the index 'n' corresponds to the template variables defined in the rule template. This string is based on the standard arlString() representation of the rule. After replacement of the template variable values, the resulting string must be a valid ARL format string that can be parsed.

Specified by:
getTemplateString in class AbleRule
Parameters:
theTemplateVars - An ordered list of template variables referenced by this rule.
Returns:
A Text format string used to create a new rule instance.
Throws:
AbleDataException
See Also:
AbleRuleTemplate

toString

public java.lang.String toString()
Retrieve a string describing (the contents of) the object.

Overrides:
toString in class AbleRule
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.

Specified by:
traceString in class AbleRule
Parameters:
theTraceStringFlavor - An Able.TraceStringFlavor value.

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

ABLE 2.3.0 07/13/2005 14:21:00

(C) Copyright IBM Corporation 1999, 2005