|
ABLE 2.0.0 07/02/2003 10:25:01 | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.ibm.able.data.AbleLhs | +--com.ibm.able.data.AbleVariable | +--com.ibm.able.data.AbleGenericVariable | +--com.ibm.able.data.AbleTypedVariable | +--com.ibm.able.data.AbleExpressionVariable
This class holds a value of an AbleExpression object. An object of type AbleExpressionVariable contains a single, mutable field whose type is AbleExpression. Instances of AbleExpressionVariable are used by the Able rules classes in clauses and expressions. In addition, this class provides methods for evauating AbleExpressions and returning the resulting value as other datatypes, as well as other logical comparison and math operator methods useful when dealing with AbleExpressions.
Field Summary | |
---|---|
protected AbleExpression |
myValue
The current value of the variable. |
Fields inherited from class com.ibm.able.data.AbleTypedVariable |
---|
myDataTypeClass, myDataTypeClassName, myDataTypeName, myInitialParms |
Fields inherited from class com.ibm.able.data.AbleVariable |
---|
myBoundFlag, myChgSupport, myComment, myContext, myDataType, myGlobalFlag, myId, myName, myPrompt, myReferences, myStaticFlag, myTemplateFlag, myValueInitial |
Constructor Summary | |
---|---|
AbleExpressionVariable(java.lang.String theName,
AbleExpression theInitialValue)
Create a new Expression variable with the specified initial value. |
|
AbleExpressionVariable(java.lang.String theName,
boolean theStaticFlag,
boolean theGlobalFlag)
Create a new Expression variable with the specified initial value. |
|
AbleExpressionVariable(java.lang.String theName,
boolean theStaticFlag,
boolean theGlobalFlag,
AbleExpression theInitialValue)
Create a new Expression variable with the specified initial value. |
Method Summary | |
---|---|
java.lang.String |
arlDclString()
Return a formal ARL "declaration" string that describes this data object. |
void |
asgnEq(AbleRd theRhs)
Assignment: assign the current value of theRhs to this data object. |
AbleLiteral |
bitwiseXOR(AbleRd theRhs)
Logical XOR: exclusive OR the current value of this data object with the current value of theRhs. |
boolean |
cmpEq(AbleRd theRhs)
Comparison, equal to: compare the current value of this data object to the current value of theRhs. |
boolean |
cmpGt(AbleRd theRhs)
Comparison, greater than: compare the current value of this data object to the current value of theRhs. |
boolean |
cmpGtEq(AbleRd theRhs)
Comparison, greater than or equal to: compare the current value of this data object to the current value of theRhs. |
boolean |
cmpLt(AbleRd theRhs)
Comparison, less than: compare the current value of this data object to the current value of theRhs. |
boolean |
cmpLtEq(AbleRd theRhs)
Comparison, less than or equal to: compare the current value of this data object to the current value of theRhs. |
boolean |
cmpNeq(AbleRd theRhs)
Comparison, not equal to: compare the current value of this data object to the current value of theRhs. |
AbleLiteral |
compDivide(AbleRd theRhs)
Compute, divide the current value of this data object by the current value of theRhs. |
AbleLiteral |
compMinus(AbleRd theRhs)
Compute, subtract the current value of theRhs from the current value of this object. |
AbleLiteral |
compMultiply(AbleRd theRhs)
Compute, multiply the current value of this data object to the current value of theRhs. |
AbleLiteral |
compPlus(AbleRd theRhs)
Compute, add or concatenate the current value of this data object to the current value of theRhs. |
AbleLiteral |
compUnaryMinus(AbleRd theRhs)
Compute, the unary minus of the current value of this object. |
static java.lang.String |
Copyright()
Determine the copyright of this class. |
boolean |
getBooleanValue()
Retrieve the value of this data object as a boolean value. |
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. |
java.lang.Class |
getLiteralClass()
Retrieve the class of this variable's related AbleLiteral data type. |
double |
getNumericValue()
Retrieve the value of this data object as a numeric value. |
java.lang.Object |
getRawValue()
Retrieve the variable's current value. |
java.lang.String |
getStringValue()
Retrieve the value of this data object as a string value. |
AbleLiteral |
getValue()
Retrieve the value of this data object as a literal. |
java.lang.String |
getValueString()
Retrieve the variable's current value as a string. |
void |
init()
Init the variable to its intial state. |
boolean |
logicalAND(AbleRd theRhs)
Logical AND the current value of this data object with the current value of theRhs. |
boolean |
logicalNOT(AbleRd theRhs)
Logical NOT: complement the current value of this data object. |
boolean |
logicalOR(AbleRd theRhs)
Logical OR the current value of this data object with the current value of theRhs. |
void |
reset()
Reset the variable to its intial state. |
void |
setBooleanValue(boolean theNewValue)
Set the value of this data object from a boolean value. |
void |
setFuzzyValue(AbleFuzzySet theNewValue)
Set the value of this data object from a fuzzy value. |
void |
setGenericValue(java.lang.Object theNewValue)
Set the value of this data object from an object. |
void |
setNumericValue(double theNewValue)
Set the value of this data object from a numeric value. |
protected void |
setRawValue(java.lang.Object theNewValue)
Set the variable's current value. |
void |
setStringValue(java.lang.String theNewValue)
Set the value of this data object from a string value. |
void |
setValue(AbleLiteral theNewValue)
Set the value of this data object from a literal object. |
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 |
xmlDclString()
Return a formal XML "declaration" string that describes this data object. |
Methods inherited from class com.ibm.able.data.AbleTypedVariable |
---|
getDataTypeName |
Methods inherited from class com.ibm.able.data.AbleGenericVariable |
---|
cmpIs, replaceValues, setValueString |
Methods inherited from class com.ibm.able.data.AbleVariable |
---|
arlCRdString, arlInitializerString, getArlComment, getChgSupport, getComment, getContext, getDataType, getDataTypeAsString, getId, getName, getPrompt, getPromptString, getReferences, getReferent, getReferents, getTemplateString, isBound, isConstant, isGlobal, isLocal, isStatic, isTemplate, notStatic, setChgSupport, setComment, setContext, setId, setInitialValue, setPrompt, setReferences, setStatic, setTemplate, xmlCRdString, xmlCWrString, xmlInitializerString |
Methods inherited from class com.ibm.able.data.AbleLhs |
---|
asgnIs, asgnIs, bitwiseAND, bitwiseNOT, bitwiseOR, bitwiseShiftLeft, bitwiseShiftRight, bitwiseShiftRightZeroFill, compModulo |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
protected AbleExpression myValue
Constructor Detail |
public AbleExpressionVariable(java.lang.String theName, AbleExpression theInitialValue)
theName
- The unique name of the variable.
theInitialValue
- The value to which this variable is initially set.
public AbleExpressionVariable(java.lang.String theName, boolean theStaticFlag, boolean theGlobalFlag, AbleExpression theInitialValue)
theName
- The unique name of the variable.
theStaticFlag
- Use true if this variable is to be marked as
static, which means that it will ignore future reset
requests; use false if the variable can be
reset to its initial value when requested.
theGlobalFlag
- Use true if this variable is to be considered
global;
use false if the variable is to be considered
local.
theInitialValue
- The value to which this variable is initially set.
public AbleExpressionVariable(java.lang.String theName, boolean theStaticFlag, boolean theGlobalFlag)
theName
- The unique name of the variable.
theStaticFlag
- Use true if this variable is to be marked as
static, which means that it will ignore future reset
requests; use false if the variable can be
reset to its initial value when requested.
theGlobalFlag
- Use true if this variable is to be considered
global;
use false if the variable is to be considered
local.
theInitialValue
- The value to which this variable is initially set.
Method Detail |
public boolean getBooleanValue() throws AbleDataException
getBooleanValue
in class AbleGenericVariable
AbleDataException
- If the value of this object cannot be represented as
a boolean value.public AbleFuzzySet getFuzzyValue() throws AbleDataException
getFuzzyValue
in class AbleGenericVariable
AbleDataException
- If the value of this object cannot be represented as
a fuzzy value.public java.lang.Object getGenericValue() throws AbleDataException
getGenericValue
in class AbleGenericVariable
AbleDataException
- If the value of this object cannot be represented as
an Object.public double getNumericValue() throws AbleDataException
getNumericValue
in class AbleGenericVariable
AbleDataException
- If the value of this object cannot be represented as
a numeric value.public java.lang.String getStringValue() throws AbleDataException
getStringValue
in class AbleGenericVariable
AbleDataException
- If the value of this object cannot be represented as
a string value.public AbleLiteral getValue() throws AbleDataException
getValue
in class AbleGenericVariable
AbleDataException
- If the value of this object cannot be represented as
a literal.public void asgnEq(AbleRd theRhs) throws AbleDataException
asgnEq
in class AbleGenericVariable
theRhs
- The right-hand, or source, side of the assignment.
AbleDataException
- If the right-hand side cannot be converted (if
necessary) and assigned to this data object.public boolean cmpEq(AbleRd theRhs) throws AbleDataException
"==" is used for numeric and boolean compares; equals() is used for Object compares; and Collator.equals() is used for String compares.
cmpEq
in class AbleGenericVariable
theRhs
- The right-hand side of the comparison.
AbleDataException
- If the right-hand side cannot be converted (if
necessary) and compared to this data object.public boolean cmpGt(AbleRd theRhs) throws AbleDataException
">" is used for numeric compares; Collator.compare() is used for String compares. Use of other data types on the left-hand side causes an exception.
cmpGt
in class AbleGenericVariable
theRhs
- The right-hand side of the comparison.
AbleDataException
- If the right-hand side cannot be converted (if
necessary) and compared to this data object.public boolean cmpGtEq(AbleRd theRhs) throws AbleDataException
">=" is used for numeric compares; Collator.compare() is used for String compares. Use of other data types on the left-hand side causes an exception.
cmpGtEq
in class AbleGenericVariable
theRhs
- The right-hand side of the comparison.
AbleDataException
- If the right-hand side cannot be converted (if
necessary) and compared to this data object.public boolean cmpLt(AbleRd theRhs) throws AbleDataException
"<" is used for numeric compares; Collator.compare() is used for String compares. Use of other data types on the left-hand side causes an exception.
cmpLt
in class AbleGenericVariable
theRhs
- The right-hand side of the comparison.
AbleDataException
- If the right-hand side cannot be converted (if
necessary) and compared to this data object.public boolean cmpLtEq(AbleRd theRhs) throws AbleDataException
"<=" is used for numeric compares; Collator.compare() is used for String compares. Use of other data types on the left-hand side causes an exception.
cmpLtEq
in class AbleGenericVariable
theRhs
- The right-hand side of the comparison.
AbleDataException
- If the right-hand side cannot be converted (if
necessary) and compared to this data object.public boolean cmpNeq(AbleRd theRhs) throws AbleDataException
"!=" is used for numeric and boolean compares; ! equals() is used for Object compares; and ! Collator.equals() is used for String compares.
cmpNeq
in class AbleGenericVariable
theRhs
- The right-hand side of the comparison.
AbleDataException
- If the right-hand side cannot be converted (if
necessary) and compared to this data object.public AbleLiteral compPlus(AbleRd theRhs) throws AbleDataException
"+" is used for numeric addtion and String concatenation.
compPlus
in class AbleGenericVariable
theRhs
- The right-hand side of the comparison.
AbleDataException
- If the right-hand side cannot be converted (if
necessary) and compared to this data object.public AbleLiteral compMinus(AbleRd theRhs) throws AbleDataException
"-" is used for numeric subtraction.
compMinus
in class AbleGenericVariable
theRhs
- The right-hand side of the comparison.
AbleDataException
- If the right-hand side cannot be converted (if
necessary) and compared to this data object.public AbleLiteral compMultiply(AbleRd theRhs) throws AbleDataException
"*" is used for numeric multiplication.
compMultiply
in class AbleGenericVariable
theRhs
- The right-hand side of the comparison.
AbleDataException
- If the right-hand side cannot be converted (if
necessary) and compared to this data object.public AbleLiteral compDivide(AbleRd theRhs) throws AbleDataException
"/" is used for numeric division.
compDivide
in class AbleGenericVariable
theRhs
- The right-hand side of the comparison.
AbleDataException
- If the right-hand side cannot be converted (if
necessary) and compared to this data object.public AbleLiteral compUnaryMinus(AbleRd theRhs) throws AbleDataException
"-" is used for numeric negation.
compUnaryMinus
in class AbleGenericVariable
theRhs
- The right-hand side of the operation (ignored).
AbleDataException
- If the value of this data object cannot be negated.public boolean logicalAND(AbleRd theRhs) throws AbleDataException
"&&" is used for boolean AND.
logicalAND
in class AbleLhs
theRhs
- The right-hand side of the comparison.
AbleDataException
- If the right-hand side cannot be converted (if
necessary) and compared to this data object.public boolean logicalOR(AbleRd theRhs) throws AbleDataException
"||" is used for boolean OR.
logicalOR
in class AbleLhs
theRhs
- The right-hand side of the comparison.
AbleDataException
- If the right-hand side cannot be converted (if
necessary) and compared to this data object.public boolean logicalNOT(AbleRd theRhs) throws AbleDataException
"!" is used for boolean NOT.
logicalNOT
in class AbleLhs
theRhs
- The right-hand side of the comparison.
AbleDataException
- If the right-hand side cannot be converted (if
necessary) and compared to this data object.public AbleLiteral bitwiseXOR(AbleRd theRhs) throws AbleDataException
"^" is used for bitwise or logical XOR.
bitwiseXOR
in class AbleLhs
theRhs
- The right-hand side of the operation.
AbleDataException
- If the right-hand side cannot be converted (if
necessary) and compared to this data object.public void setBooleanValue(boolean theNewValue) throws AbleDataException
setBooleanValue
in class AbleGenericVariable
theNewValue
- A boolean value.
If the new value is true the variable is set to
1.0;
if the new value is false the variable is set to
0.0.
AbleDataException
- If the value of this object cannot be represented as
a boolean value.public void setFuzzyValue(AbleFuzzySet theNewValue) throws AbleDataException
setFuzzyValue
in class AbleGenericVariable
theNewValue
- A fuzzy set.
AbleDataException
- If the value of this object cannot be represented as
a fuzzy value.public void setGenericValue(java.lang.Object theNewValue) throws AbleDataException
setGenericValue
in class AbleGenericVariable
theNewValue
- Any type of Object.
AbleDataException
- If the value of this object cannot be derived from
the specified Object.public void setNumericValue(double theNewValue) throws AbleDataException
setNumericValue
in class AbleGenericVariable
theNewValue
- Any number.
AbleDataException
- If the value of this object cannot be represented as
a numeric value.public void setStringValue(java.lang.String theNewValue) throws AbleDataException
setStringValue
in class AbleTypedVariable
theNewValue
- A string.
The variable is set to the value of the string, but
only if the string can be parsed to a double;
otherwise an exception is thrown.
AbleDataException
- If the value of this object cannot be represented as
a string value.public void setValue(AbleLiteral theNewValue) throws AbleDataException
setValue
in class AbleGenericVariable
theNewValue
- An Able literal of any type. An attempt is made to
convert the literal to an appropriate type before
assigning it to this "writable" object.
AbleDataException
- If the value of this object cannot be determined
from the literal object.public java.lang.String arlDclString()
arlDclString
in class AbleTypedVariable
public java.lang.String xmlDclString()
xmlDclString
in class AbleTypedVariable
public java.lang.String getValueString()
getValueString
in class AbleGenericVariable
public void reset() throws AbleDataException
reset
in class AbleTypedVariable
public void init() throws AbleDataException
init
in class AbleTypedVariable
public java.lang.Class getDataTypeClass()
AbleLhs
getDataTypeClass
in class AbleTypedVariable
com.ibm.able.data.AbleLhs
public java.lang.String getDataTypeClassName()
AbleLhs
getDataTypeClassName
in class AbleTypedVariable
com.ibm.able.data.AbleLhs
public java.lang.Class getLiteralClass()
getLiteralClass
in class AbleGenericVariable
protected void setRawValue(java.lang.Object theNewValue) throws AbleDataException
Note that this method fires a PropertyChange with both old and new values, but only if a PropertyChangeSupport object has been set in the variable.
Note that this method updates all objects that refer to this variable, but only if a set of references has been set in the variable.
setRawValue
in class AbleTypedVariable
public java.lang.Object getRawValue()
public java.lang.String toString()
toString
in class AbleTypedVariable
public java.lang.String traceString(int theTraceStringFlavor)
traceString
in class AbleTypedVariable
theFlavor
- An Able.TraceStringFlavor value.
public static java.lang.String Copyright()
|
ABLE 2.0.0 07/02/2003 10:25:01 | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |