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 AbleIfThenElseStatement

    java.lang.Object
      com.ibm.able.data.AbleLiteral
          com.ibm.able.rules.AbleIfThenElseStatement

All Implemented Interfaces:
  AbleRd, java.io.Serializable

public class AbleIfThenElseStatement
extends AbleLiteral
implements java.io.Serializable

This class holds the expressions and actions used in an if-then-else action (which could be nested in other rules or actions). The antecedent expression can be an arbitrarily complex boolean expression and the then{} and else{} sections can contain one or more consequent (action) clauses.

See Also:
  Serialized Form

Field Summary
`protected AbleExpression` | `myAntecedent` myAntecedent is an AbleExpression that evaluates to a boolean value.
`protected java.util.Vector` | `myElseActions` myElseActions is a list of AbleConsequentClause objects.
`protected AbleRuleBlock` | `myRuleBlock`
`protected AbleRuleSet` | `myRuleSet`
`protected java.util.Vector` | `myThenActions` myThenActions is a list of AbleConsequentClause objects.

Constructor Summary
`AbleIfThenElseStatement(AbleRuleSet theRuleSet, AbleRuleBlock theRuleBlock, AbleExpression theAntecedent)` Create a new if/then/else statement with the specified condition and no actions.
`AbleIfThenElseStatement(AbleRuleSet theRuleSet, AbleRuleBlock theRuleBlock, AbleExpression theAntecedent, java.util.Vector theThenActions, java.util.Vector theElseActions)` Create a new if/then/else statement with the specified condition and actions.

Method Summary
`void` | `addElseAction(AbleConsequentClause theAction)`
`void` | `addThenAction(AbleConsequentClause theAction)`
`java.lang.String` | `arlCRdString()` Return a formal ARL "clause read" string that describes this data object.
`java.lang.String` | `arlString()` Return a formal Able Rule Language (ARL) String.
`java.lang.String` | `armlString()` Return a formal XML string.
`protected void` | `evalConsequentClause(AbleConsequentClause theClause)` Evaluate the specified consequent clause.
`AbleExpression` | `getAntecedent()` Retrieve the rule's list of antecedent clauses.
`boolean` | `getBooleanValue()` Retrieve the value of this data object as a boolean value.
`int` | `getDataType()` Retrieve the data type of this data object.
`java.lang.Class` | `getDataTypeClass()` Retrieve the actual class of this object's underlying data type.
`java.lang.String` | `getDataTypeClassName()` Retrieve the name of the class of this object's underlying data type.
`java.util.Vector` | `getElseActions()` Retrieve the rule's list of else clauses.
`AbleFuzzySet` | `getFuzzyValue()` Retrieve the value of this data object as a fuzzy value.
`java.lang.Object` | `getGenericValue()` Retrieve the value of this data object as an Object.
`double` | `getNumericValue()` Retrieve the value of this data object as a numeric value.
`java.lang.String` | `getStringValue()` Retrieve the value of this data object as a string value.
`java.lang.String` | `getTemplateString(java.util.Vector theTemplateVars)` Retrieve a text format string for use by rule templates.
`java.util.Vector` | `getThenActions()` Retrieve the rule's list of consequent clauses.
`AbleLiteral` | `getValue()` Retrieve the value of this data object as a literal.
`long` | `numberOfElseClauses()` Retrieve the number of else clauses in this rule.
`long` | `numberOfThenClauses()` Retrieve the number of consequent clauses in this rule.
`void` | `setElseActions(java.util.Vector theElseActions)`
`void` | `setThenActions(java.util.Vector theThenActions)`
`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` | `xmlCRdString()` Return a formal XML "clause read" string that describes this data object.
`java.lang.String` | `xmlString()` Return a formal XML string.

Methods inherited from class com.ibm.able.data.AbleLiteral
`bitwiseAND, bitwiseNOT, bitwiseOR, bitwiseShiftLeft, bitwiseShiftRight, bitwiseShiftRightZeroFill, bitwiseXOR, cmpEq, cmpGt, cmpGtEq, cmpIs, cmpLt, cmpLtEq, cmpNeq, compDivide, compMinus, compModulo, compMultiply, compPlus, compUnaryMinus, getDataTypeAsString, getReferent, getReferents, isConstant, logicalAND, logicalNOT, logicalOR`

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

Field Detail

### myAntecedent

    protected AbleExpression myAntecedent

  myAntecedent is an AbleExpression that evaluates to a boolean value.

### myThenActions

    protected java.util.Vector myThenActions

  myThenActions is a list of AbleConsequentClause objects. At least one must be present.

### myElseActions

    protected java.util.Vector myElseActions

  myElseActions is a list of AbleConsequentClause objects. The list may by empty, but it is never null.

### myRuleSet

    protected AbleRuleSet myRuleSet

### myRuleBlock

    protected AbleRuleBlock myRuleBlock

Constructor Detail

### AbleIfThenElseStatement

    public AbleIfThenElseStatement(AbleRuleSet theRuleSet,
                                   AbleRuleBlock theRuleBlock,
                                   AbleExpression theAntecedent,
                                   java.util.Vector theThenActions,
                                   java.util.Vector theElseActions)

  Create a new if/then/else statement with the specified condition and actions.

Parameters:
  `theRuleSet` - The ruleset to provide the context for the new statement.
  `theRuleBlock` - The ruleblock to insert the new statement.
  `theAntecedent` - An AbleExpression that defines the antecedent for this statement.

  `theThenActions` - A list of assignment statements that define the consequents of this rule. The list must contain at least one AbleConsequentClause. The list is cloned.

  `theElseActions` - A list of assignment statements that define the actions to perform when the antecedents fail. The list may be empty, but it must not be null. The list is cloned.

### AbleIfThenElseStatement

    public AbleIfThenElseStatement(AbleRuleSet theRuleSet,
                                   AbleRuleBlock theRuleBlock,
                                   AbleExpression theAntecedent)

  Create a new if/then/else statement with the specified condition and no actions. Use setThenActions() and setElseActions() to specify conditions.

Parameters:
  `theRuleSet` - The ruleset to provide the context for the new statement.
  `theRuleBlock` - The ruleblock to insert the new statement.
  `theAntecedent` - An AbleExpression that defines the antecedent for this statement

Method Detail

### addThenAction

    public void addThenAction(AbleConsequentClause theAction)

### addElseAction

    public void addElseAction(AbleConsequentClause theAction)

### getAntecedent

    public final AbleExpression getAntecedent()

  Retrieve the rule's list of antecedent clauses.

  Returns:
    A reference to the actual list of antecedent clauses. This list may be empty (and will be empty if the rule is an assertion rather than a conditional rule), but the list is never null.

### getThenActions

    public final java.util.Vector getThenActions()

  Retrieve the rule's list of consequent clauses.

  Returns:
    The consequent clauses of the rule.

### setThenActions

    public void setThenActions(java.util.Vector theThenActions)

### numberOfThenClauses

    public long numberOfThenClauses()

  Retrieve the number of consequent clauses in this rule.

  Returns:
    The number of clauses.

### getElseActions

    public final java.util.Vector getElseActions()

  Retrieve the rule's list of else clauses.

  Returns:
    The else clauses of the rule.

### setElseActions

    public void setElseActions(java.util.Vector theElseActions)

### numberOfElseClauses

    public long numberOfElseClauses()

  Retrieve the number of else clauses in this rule.

  Returns:
    The number of clauses.

### 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.

### getTemplateString

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

  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 interface `AbleRd`
  Overrides:
    `getTemplateString` in class `AbleLiteral`
  Parameters:
    `theTemplateVars` - An ordered list of template variables referenced by this rule.
  Returns:
    A Text format string used to create a new rule instance.
  See Also:
    `AbleRuleTemplate`

### toString

    public java.lang.String toString()

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

  Overrides:
    `toString` in class `AbleLiteral`
  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 interface `AbleRd`
  Specified by:
    `traceString` in class `AbleLiteral`
  Parameters:
    `theTraceStringFlavor` - An Able.TraceStringFlavor value.

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

### getValue

    public AbleLiteral getValue()
                         throws AbleDataException

  Retrieve the value of this data object as a literal.

  Specified by:
    `getValue` in interface `AbleRd`
  Specified by:
    `getValue` in class `AbleLiteral`
  Returns:
    An AbleNumericLiteral object.
  Throws:
    `AbleDataException` - If the value of this object cannot be represented as a literal.

### evalConsequentClause

    protected void evalConsequentClause(AbleConsequentClause theClause)
                                 throws AbleDataException

  Evaluate the specified consequent clause.

  Parameters:
    `theClause` - a consequent clause to evaluate.

  Throws:
    `AbleDataException` - when the clause's data objects are incompatible, or when the relational operator is invalid for the current situation or unrecognized.

### getDataTypeClass

    public java.lang.Class getDataTypeClass()

  Description copied from class: `AbleLiteral`
  Retrieve the actual class of this object's underlying data type.

  Specified by:
    `getDataTypeClass` in interface `AbleRd`
  Specified by:
    `getDataTypeClass` in class `AbleLiteral`
  Returns:
    The class of the underlying data type.

### getDataTypeClassName

    public java.lang.String getDataTypeClassName()

  Description copied from class: `AbleLiteral`
  Retrieve the name of the class of this object's underlying data type.

  Specified by:
    `getDataTypeClassName` in interface `AbleRd`
  Specified by:
    `getDataTypeClassName` in class `AbleLiteral`
  Returns:
    A String that is the name of the class of the underlying data type.

### arlCRdString

    public java.lang.String arlCRdString()

  Return a formal ARL "clause read" string that describes this data object.

  Specified by:
    `arlCRdString` in interface `AbleRd`
  Specified by:
    `arlCRdString` in class `AbleLiteral`
  Returns:
    A String describing the data object in formal rule language. Double.toString() is used to produce the string.

### getBooleanValue

    public boolean getBooleanValue()
                            throws AbleDataException

  Description copied from class: `AbleLiteral`
  Retrieve the value of this data object as a boolean value.

  Specified by:
    `getBooleanValue` in interface `AbleRd`
  Specified by:
    `getBooleanValue` in class `AbleLiteral`
  Returns:
    A boolean, if the value of this object can be represented as a boolean value.
  Throws:
    `AbleDataException` - If the value of this object cannot be represented as a boolean value.

### getFuzzyValue

    public AbleFuzzySet getFuzzyValue()
                               throws AbleDataException

  Description copied from class: `AbleLiteral`
  Retrieve the value of this data object as a fuzzy value.

  Specified by:
    `getFuzzyValue` in interface `AbleRd`
  Specified by:
    `getFuzzyValue` in class `AbleLiteral`
  Returns:
    A fuzzy set, if the value of this object can be represented as a fuzzy value.
  Throws:
    `AbleDataException` - If the value of this object cannot be represented as a fuzzy value.

### getGenericValue

    public java.lang.Object getGenericValue()
                                     throws AbleDataException

  Description copied from class: `AbleLiteral`
  Retrieve the value of this data object as an Object.

  Specified by:
    `getGenericValue` in interface `AbleRd`
  Specified by:
    `getGenericValue` in class `AbleLiteral`
  Returns:
    A Boolean, Double, String or Object object depending on the derived class.
  Throws:
    `AbleDataException` - If the value of this object cannot be represented as an Object.

### getNumericValue

    public double getNumericValue()
                           throws AbleDataException

  Description copied from class: `AbleLiteral`
  Retrieve the value of this data object as a numeric value.

  Specified by:
    `getNumericValue` in interface `AbleRd`
  Specified by:
    `getNumericValue` in class `AbleLiteral`
  Returns:
    A double, if the value of this object can be represented as a numeric value.
  Throws:
    `AbleDataException` - If the value of this object cannot be represented as a numeric value.

### getStringValue

    public java.lang.String getStringValue()
                                    throws AbleDataException

  Description copied from class: `AbleLiteral`
  Retrieve the value of this data object as a string value.

  Specified by:
    `getStringValue` in interface `AbleRd`
  Specified by:
    `getStringValue` in class `AbleLiteral`
  Returns:
    A String, if the value of this object can be represented as a string value.
  Throws:
    `AbleDataException` - If the value of this object cannot be represented as a string value.

### xmlCRdString

    public java.lang.String xmlCRdString()

  Description copied from class: `AbleLiteral`
  Return a formal XML "clause read" string that describes this data object.

  Specified by:
    `xmlCRdString` in interface `AbleRd`
  Specified by:
    `xmlCRdString` in class `AbleLiteral`
  Returns:
    A String describing the data object in XML.

### getDataType

    public int getDataType()

  Description copied from class: `AbleLiteral`
  Retrieve the data type of this data object.

  Specified by:
    `getDataType` in interface `AbleRd`
  Specified by:
    `getDataType` in class `AbleLiteral`
  Returns:
    An AbleData.<DataType> constant.
  See Also:
    `AbleRd.getDataType()`

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