|
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 | |||||||||||
java.lang.Objectcom.ibm.able.data.AbleLiteral
com.ibm.able.rules.AbleSwitchStatement
This class holds the expressions and actions used in a switch action (which could be nested in other rules or actions). The integer expression can be an arbitrarily complex integer expression and the case sections can contain one or more consequent (action) clauses.
| Nested Class Summary | |
|---|---|
class |
AbleSwitchStatement.CaseListElement_
This class is used to store information about each 'case' as it is defined. |
| Constructor Summary | |
|---|---|
AbleSwitchStatement(AbleRuleSet theRuleSet,
AbleRuleBlock theRuleBlock,
AbleExpression theIntExpression)
Creates a new switch statement with the specified integer expression. |
|
| Method Summary | |
|---|---|
void |
addCaseCode(AbleConsequentClause theCaseCode)
Adds a single line of code to the body of the last added case label. |
void |
addCaseCode(java.util.Collection theCaseCode)
Adds a block of code to the body of the last added case label. |
void |
addCaseLabel(AbleRd theCaseLabel)
Adds a new case label to the current set of switch cases. |
void |
addDefaultCode(AbleConsequentClause theDefaultCode)
Adds a single line of code to this switch statement's 'default' code block. |
void |
addDefaultCode(java.util.Collection theDefaultCode)
Adds a block of code to this switch statement's 'default' code block. |
java.lang.String |
arlCRdString()
Returns a formal ARL "clause read" (CRd) string representation of this statement. |
java.lang.String |
arlString()
Returns a formal ABLE Rule Language (ARL) string representation of this statement. |
java.lang.String |
armlString()
Returns a formal ABLE Rule Markup Language (ARML) string representation of this statement. |
protected void |
evalConsequentClause(AbleConsequentClause theClause)
Evaluate the specified consequent clause. |
void |
evaluate()
Evaluates this switch statement. |
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. |
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. |
AbleLiteral |
getValue()
Retrieves the value of this data object as a literal. |
java.lang.String |
toString()
Retrieves a string describing (the contents of) the object. |
java.lang.String |
traceString(int theTraceStringFlavor)
Retrieves a string describing (the contents of) the object. |
java.lang.String |
xmlCRdString()
Returns a formal XML "clause read" (CRd) string representation of this statement. |
java.lang.String |
xmlString()
Returns a formal XML string representation of this statement. |
| 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 |
| Constructor Detail |
public AbleSwitchStatement(AbleRuleSet theRuleSet,
AbleRuleBlock theRuleBlock,
AbleExpression theIntExpression)
Use
addCaseLabel(AbleRd),
addCaseCode(Collection), and
addDefaultCode(Collection)
to build up the desired switch construct.
theRuleSet - The ruleset to which this statement belongs.theRuleBlock - The ruleblock to which this statement belongs.theIntExpression - An AbleExpression that, when evaluated, will determine
the entry point into the code body. This expression
must be able to give up an Integer value.| Method Detail |
public void addCaseLabel(AbleRd theCaseLabel)
throws AbleParException
case 1: case 2:or this method may be followed by a call to
addCaseCode(Collection) to create something like:
case 1:
statement1;
statement2;
theCaseLabel - An expression that must give up an integer value. The
expression is evaluated immediately, and the returned
value becomes the fixed key to an entry point in the
code table.
AbleParException - When theCaseLabel cannot be turned into an
integer value.public void addCaseCode(java.util.Collection theCaseCode)
A single line of code may also be added to the code body by
using the addCaseCode(AbleConsequentClause) method.
theCaseCode - A collection of one or more code statements.public void addCaseCode(AbleConsequentClause theCaseCode)
Multiple lines of code may also be added all at once by using
the addCaseCode(Collection) method.
theCaseCode - A single code statement.public void addDefaultCode(java.util.Collection theDefaultCode)
The default code block is evaluated either when (1) the integer expression fails to resolve to a code body entry point, or (2) the code body falls through to this code due to the lack of a 'break' statement. Note that there does not have to be a default block of code; that is, the list can be empty, in which case this method does not have to be called at all.
This method may be called multiple times, allowing the default code body to be built up several lines at a time or all at once.
A single line of code may also be added to the default code
body by using the addDefaultCode(AbleConsequentClause)
method.
theDefaultCode - A collection of one or more code statements.public void addDefaultCode(AbleConsequentClause theDefaultCode)
The default code block is evaluated either when (1) the integer expression fails to resolve to a code body entry point, or (2) the code body falls through to this code due to the lack of a 'break' statement. Note that there does not have to be a default block of code; that is, the list can be empty, in which case this method does not have to be called at all.
This method may be called multiple times, allowing the default code body to be built up a line at a time.
Multiple lines of code may also be added to the default code
body all at once by using the addDefaultCode(Collection)
method.
theDefaultCode - A single code statement.
public AbleLiteral getValue()
throws AbleDataException
Yeah, OK, this method is really used just to evaluate this statement, which shouldn't return anything.
getValue in interface AbleRdgetValue in class AbleLiteralAbleDataException - If the value of this object cannot be represented as
a literal.
public void evaluate()
throws AbleDataException
AbleDataException - If any data conversion error is encountered while
evaluating this statement.
protected void evalConsequentClause(AbleConsequentClause theClause)
throws AbleDataException
theClause - a consequent clause to evaluate.
AbleDataException - when the clause's data objects are incompatible, or
when the relational operator is invalid for the
current situation or unrecognized.public java.lang.String arlString()
public java.lang.String armlString()
public java.lang.String xmlString()
public java.lang.String getTemplateString(java.util.Vector theTemplateVars)
getTemplateString in interface AbleRdgetTemplateString in class AbleLiteraltheTemplateVars - An ordered list of template variables referenced by
this rule.
AbleRuleTemplatepublic java.lang.String toString()
toString in class AbleLiteralpublic java.lang.String traceString(int theTraceStringFlavor)
traceString in interface AbleRdtraceString in class AbleLiteraltheTraceStringFlavor - An Able.TraceStringFlavor value.
public int getDataType()
AbleLiteral
getDataType in interface AbleRdgetDataType in class AbleLiteralAbleRd.getDataType()public java.lang.Class getDataTypeClass()
AbleLiteral
getDataTypeClass in interface AbleRdgetDataTypeClass in class AbleLiteralpublic java.lang.String getDataTypeClassName()
AbleLiteral
getDataTypeClassName in interface AbleRdgetDataTypeClassName in class AbleLiteralpublic java.lang.String arlCRdString()
arlCRdString in interface AbleRdarlCRdString in class AbleLiteralpublic java.lang.String xmlCRdString()
xmlCRdString in interface AbleRdxmlCRdString in class AbleLiteral
public boolean getBooleanValue()
throws AbleDataException
AbleLiteral
getBooleanValue in interface AbleRdgetBooleanValue in class AbleLiteralAbleDataException - If the value of this object cannot be represented as
a boolean value.
public AbleFuzzySet getFuzzyValue()
throws AbleDataException
AbleLiteral
getFuzzyValue in interface AbleRdgetFuzzyValue in class AbleLiteralAbleDataException - If the value of this object cannot be represented as
a fuzzy value.
public java.lang.Object getGenericValue()
throws AbleDataException
AbleLiteral
getGenericValue in interface AbleRdgetGenericValue in class AbleLiteralAbleDataException - If the value of this object cannot be represented as
an Object.
public double getNumericValue()
throws AbleDataException
AbleLiteral
getNumericValue in interface AbleRdgetNumericValue in class AbleLiteralAbleDataException - If the value of this object cannot be represented as
a numeric value.
public java.lang.String getStringValue()
throws AbleDataException
AbleLiteral
getStringValue in interface AbleRdgetStringValue in class AbleLiteralAbleDataException - If the value of this object cannot be represented as
a string value.
|
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 | |||||||||||