IBM WebSphere Application ServerTM
Release 7

com.ibm.wbiserver.brules.mgmt.dtable
Interface ConditionNode

All Superinterfaces:
BusinessRuleChangeDetector, BusinessRuleValidateable, java.io.Serializable, TreeNode

public interface ConditionNode
extends java.io.Serializable, TreeNode

This interface represents on condition in a decision tree. A condition node has a reference to a condition term definition that defines the term ("left-hand side") for this condition. It also contains a list of case edges which represent the cases to be checked for for the specified term. Each case edge defines a particular condition, such as "== 100" or ">=1000 and < 10000", that is checked for this term. Each case edge refers to a child node which is the either the next condition node in the tree or is an action node that defines the action to take. The case edge whose condition evaluates to true is followed to get to the next node in the tree.


Field Summary
static java.lang.String COPYRIGHT
           
 
Method Summary
 void addConditionValueToThisLevel(TemplateInstanceExpression newConditionValue)
          Add a new condition value to all the condition nodes at the same level as this one in the decision tree.
 java.util.List<TreeConditionValueTemplate> getAvailableValueTemplates()
          Get the value templates available for use by this condition node.
 java.util.List<CaseEdge> getCaseEdges()
          Get the list of case edges for this condition node.
 TreeNode getOtherwiseCase()
          This is a 'condition' that is satisfied if no other condition is satisfied.
 TreeConditionTermDefinition getTermDefinition()
          Get the term definition for this condition.
 boolean removeConditionValue(TemplateInstanceExpression conditionValueToRemove)
          Remove the specified condition value from this condition node.
 
Methods inherited from interface com.ibm.wbiserver.brules.mgmt.dtable.TreeNode
getContainingTreeBlock, getParentNode, getRootNode, isOtherwiseCase
 
Methods inherited from interface com.ibm.wbiserver.brules.mgmt.BusinessRuleValidateable
validate
 
Methods inherited from interface com.ibm.wbiserver.brules.mgmt.BusinessRuleChangeDetector
hasChanges
 

Field Detail

COPYRIGHT

static final java.lang.String COPYRIGHT
See Also:
Constant Field Values
Method Detail

getCaseEdges

java.util.List<CaseEdge> getCaseEdges()
Get the list of case edges for this condition node. Each case edge defines the value for a particular case for this condition.

Returns:
A list of case edges for this condition node. The returned List is unmodifiable.

removeConditionValue

boolean removeConditionValue(TemplateInstanceExpression conditionValueToRemove)
Remove the specified condition value from this condition node. This method will remove the case edge with the specified template instance expression from the list of case edges for this condition node. As a result, the entire sub-tree underneath that case edge will also be removed. If no case edge in this condition node has the specified template instance expression as its value, then the list of case edges is unchanged.

The condition value is specified by passing in the template instance expression obtained from one of the case edges in this condition node. Only condition values defined by template instance expressions can be removed using this method.

Parameters:
conditionValueToRemove - The template instance expression from the case edge to be removed. Must not be null.
Returns:
true if and only if conditionValueToRemove was found and removed.

addConditionValueToThisLevel

void addConditionValueToThisLevel(TemplateInstanceExpression newConditionValue)
                                  throws ValidationException,
                                         java.lang.IllegalArgumentException
Add a new condition value to all the condition nodes at the same level as this one in the decision tree. A new condition value must be added to all nodes at a given level in the tree rather than just one node in order to keep the tree balanced. A decision table always requires a balanced decision tree.

This method adds a new case edge to this condition node and all other condition nodes at the same level in the tree. Each new case edge represents the same value, the value specified by the passed in TemplateInstanceExpression. Each case edge needs a new subtree underneath it. The subtree will be a clone of one of the existing subtrees under one of the existing case edges for the condition node that the case edge is being added to. This effectively adds a new subtree under each of the condition nodes at this level that is a clone of the existing subtrees. Each new subtree is reachable via the new case edges added to the existing condition nodes. Condition nodes within these new subtrees are copies of the condition nodes in the existing subtrees.

Each new subtree also results in a new set of action nodes as the leaf nodes of the subtree. These leaf nodes need to have values set to define what the action is. Each tree action in these new action nodes starts with no value defined. The client should navigate down to each of the new action nodes and add template instance expressions to each of the tree actions to define the action.

Parameters:
newConditionValue - The new condition value to be added to all condition nodes at this level in the tree. This TemplateInstanceExpression cannot be null and must be derived from a value template that is available to this condition node.
Throws:
ValidationException - if the passed in TemplateInstanceExpression is not derived from a template that is available to this condition node.
java.lang.IllegalArgumentException - if the passed in TemplateInstanceExpression is null.
ChangesNotAllowedException - if changes to this object are temporarily disallowed while other changes are being published.

getTermDefinition

TreeConditionTermDefinition getTermDefinition()
Get the term definition for this condition. The term definition defines the "left-hand side" of the condition.

Returns:
The term definition for this condition.

getAvailableValueTemplates

java.util.List<TreeConditionValueTemplate> getAvailableValueTemplates()
Get the value templates available for use by this condition node. This is the set of templates that can be used to define TemplateInstanceExpressions for this condition node. This is a convenience method and is equivalent to performing the following sequence of method calls on this object: getTermDefinition().getConditionValueTemplates().

Returns:
The value templates available for use by this condition node. The returned List is unmodifiable.

getOtherwiseCase

TreeNode getOtherwiseCase()
This is a 'condition' that is satisfied if no other condition is satisfied. You use this method to find the right-most 'case edges' (in the case where there is an 'otherwise' node)—otherwise isn't a CaseEdge, it is a condition that is satisfied if no other condition is satisfied.

Returns:
the TreeNode that is traversed if no other ConditionNode is satisfied.

IBM WebSphere Application ServerTM
Release 7