|
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.AbleArrayVariable
This class wraps a value of the type Object[] in an AbleVariable object. An object of type AbleArrayVariable contains a single, mutable field whose type is Object[]. Instances of AbleArrayVariable are used by the Able rules classes in clauses and expressions. In addition, this class provides methods for replacing the entire contents of the variable or single elements based on index value.
Field Summary | |
---|---|
protected java.lang.String |
myArrayType
The data type of the elements in the array. |
protected java.lang.Class |
myArrayTypeClass
The Class of the array type (underlying elements) of the array. |
protected java.lang.Class[] |
myElementClasses
The data types of the elements of this array. |
protected int |
myLength
The number of elements in the array. |
protected java.lang.Object[] |
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 | |
---|---|
AbleArrayVariable(java.lang.String theName,
boolean theStaticFlag,
boolean theGlobalFlag,
java.lang.String theArrayType,
int theLength)
Create a new array variable. |
|
AbleArrayVariable(java.lang.String theName,
java.lang.String theArrayType,
int theLength)
Create a new array variable. |
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. |
boolean |
cmpEq(AbleRd theRhs)
Comparison, 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. |
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. |
java.lang.Class |
getElementClass()
Retrieve the class of this variable'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 Array of Objects of the element type. |
int |
getLength()
|
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. |
protected 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. |
AbleLiteral |
getValueAt(int theIndex)
Retrieve the value of the specified element of the array as a literal. |
java.lang.String |
getValueString()
Retrieve the variable's current value as a string. |
void |
init()
Init the variable to its initial state. |
void |
replaceValues(java.lang.Object theNewValue)
Replace both the current value and the initial value with the specified new value. |
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 |
setLength(int theLength)
Set the number of elements (length) of the array variable Note: initial values and setValue must match this length The current contents of the array variable will be destroyed. |
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. |
void |
setValueAt(int theIndex,
AbleRd theNewValue)
Set the value of the specified element of the array as a literal. |
void |
setValueString(java.lang.String theNewValue)
Set the variable's current value from a string. |
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 |
---|
cmpGt, cmpGtEq, cmpIs, cmpLt, cmpLtEq, compDivide, compMinus, compMultiply, compPlus, compUnaryMinus |
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, bitwiseXOR, compModulo, Copyright, logicalAND, logicalNOT, logicalOR |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
protected java.lang.Object[] myValue
protected java.lang.Class[] myElementClasses
Note: usually an AbleVariable and AbleLiteral pair
protected java.lang.String myArrayType
Note: The actual Class types are defined in myElementClasses
protected java.lang.Class myArrayTypeClass
Note: For example, a Double[] would have the array type class of double.class
protected int myLength
Constructor Detail |
public AbleArrayVariable(java.lang.String theName, java.lang.String theArrayType, int theLength)
theName
- The unique name of the variable.theArrayType
- The data type of the elements of this arraytheLength
- The number of elements in the array
public AbleArrayVariable(java.lang.String theName, boolean theStaticFlag, boolean theGlobalFlag, java.lang.String theArrayType, int theLength)
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.
theArrayType
- The data type of the elements of this array
theLength
- The number of elements in the array
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 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 void setBooleanValue(boolean theNewValue) throws AbleDataException
setBooleanValue
in class AbleGenericVariable
theNewValue
- A boolean value.
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.
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 void setValueString(java.lang.String theNewValue) throws AbleDataException
setValueString
in class AbleGenericVariable
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 void setLength(int theLength)
public int getLength()
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 getElementClass()
public java.lang.Class getLiteralClass()
getLiteralClass
in class AbleGenericVariable
public AbleLiteral getValueAt(int theIndex) throws AbleDataException
AbleDataException
- If the value of this object cannot be represented as
a literal or if the index is invalid.public void setValueAt(int theIndex, AbleRd theNewValue) throws AbleDataException
theIndex
- The integer value of the array element to settheNewValue
- An Object value used to set the specified array element.AbleDataException
- If the value of this object cannot be represented as
a literal or if the index is invalid.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
protected java.lang.Object getRawValue()
public void replaceValues(java.lang.Object theNewValue)
Even though this method is public, it is primarily for the use of AbleRuleSet objects so that the special builtin variables can be updated easily when the ruleset's parent changes. It is dangerous for others to use this method.
replaceValues
in class AbleGenericVariable
theNewValue
- Any type of Object.
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.
|
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 |