ABLE 2.0.0 07/02/2003 10:25:01

com.ibm.able.data
Class AbleArrayVariableExpression

java.lang.Object
  |
  +--com.ibm.able.data.AbleLhs
        |
        +--com.ibm.able.data.AbleArrayVariableExpression
All Implemented Interfaces:
AbleRd, AbleWr, java.io.Serializable

public class AbleArrayVariableExpression
extends AbleLhs
implements java.io.Serializable

This class provides read and/or write access to a field in an object that is the value of an AbleTypedVariable.

See Also:
Serialized Form

Field Summary
protected  AbleArrayVariable myArrayVariable
          The array variable to which this field belongs.
protected  int myDataType
          An AbleData.<DataType> constant that specifies this particular object's data type.
protected  AbleRd myIndexExpression
          An expression used to compute the array index in the above array variable.
 
Constructor Summary
AbleArrayVariableExpression(AbleArrayVariable theArrayVariable, AbleRd theIndexExpression)
          Create a new array expression object.
 
Method Summary
 java.lang.String arlCRdString()
          Return a formal rule language "clause" string that describes this data object.
 java.lang.String arlDclString()
          Return a formal rule language "declaration" string that describes this data object.
 void asgnEq(AbleRd theRhs)
          Assignment (boolean): assign the current value of theRhs to this data object.
 void asgnIs(AbleRd theRhs)
          Assignment (fuzzy): assign the current value of theRhs to this data object.
 void asgnIs(AbleRd theRhs, double theTruthValue)
          Assignment (fuzzy): assign the current value of theRhs to this data object, correlated with the specified truth value.
 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.
static java.lang.String Copyright()
          Determine the copyright of this class.
 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.
 AbleRd getIndexExpression()
           
 double getNumericValue()
          Retrieve the value of this data object as a numeric value.
 int getReferent()
          Retrieve the Id of the variable to which this data object refers, if any.
 java.util.BitSet getReferents()
          Retrieve the Ids of the variables to which this data object refers, if any.
 java.lang.String getStringValue()
          Retrieve the value of this data object as a string value.
 java.lang.String getTemplateString(java.util.Vector theTemplateVars)
          Return a formatted ARL text string for use by templates
 AbleLiteral getValue()
          Retrieve the value of this data object as a literal.
 AbleArrayVariable getVariable()
           
 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 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.
 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 xmlCRdString()
          Return a formal XML "read clause" string that describes this data object; for example, "very, very hot".
 java.lang.String xmlCWrString()
          Return a formal XML "clause write" string that describes this data object.
 java.lang.String xmlDclString()
          Return a formal XML "declaration" string that describes this data object.
 
Methods inherited from class com.ibm.able.data.AbleLhs
bitwiseAND, bitwiseNOT, bitwiseOR, bitwiseShiftLeft, bitwiseShiftRight, bitwiseShiftRightZeroFill, bitwiseXOR, cmpIs, compModulo, compUnaryMinus, isConstant
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

myDataType

protected int myDataType
An AbleData.<DataType> constant that specifies this particular object's data type.

This field is initialized to AbleData.TypedVariableField.


myArrayVariable

protected AbleArrayVariable myArrayVariable
The array variable to which this field belongs.

This field is initialized to null and changed by the constructor when a new typed variable field is created.


myIndexExpression

protected AbleRd myIndexExpression
An expression used to compute the array index in the above array variable. Note: this expression is evaluated prior to every array element access

This field is initialized to null and changed by the contructor when a new typed variable field is created.

Constructor Detail

AbleArrayVariableExpression

public AbleArrayVariableExpression(AbleArrayVariable theArrayVariable,
                                   AbleRd theIndexExpression)
Create a new array expression object.
Parameters:
theArrayVariable - An array variable that contains the following element.

theIndexExpression - An AbleRd object or AbleExpression that evaluates to a specific element of the above array variable.

Method Detail

getBooleanValue

public boolean getBooleanValue()
                        throws AbleDataException
Retrieve the value of this data object as a boolean value.
Overrides:
getBooleanValue in class AbleLhs
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
Retrieve the value of this data object as a fuzzy value.
Overrides:
getFuzzyValue in class AbleLhs
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
Retrieve the value of this data object as an Object.
Overrides:
getGenericValue in class AbleLhs
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
Retrieve the value of this data object as a numeric value.
Overrides:
getNumericValue in class AbleLhs
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
Retrieve the value of this data object as a string value.
Overrides:
getStringValue in class AbleLhs
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.

getValue

public AbleLiteral getValue()
                     throws AbleDataException
Retrieve the value of this data object as a literal.
Overrides:
getValue in class AbleLhs
Returns:
An AbleLiteral object.
Throws:
AbleDataException - If the value of this object cannot be represented as a literal.

getReferent

public int getReferent()
Retrieve the Id of the variable to which this data object refers, if any.
Overrides:
getReferent in class AbleLhs
Returns:
The Id of the variable to which this data object refers, or AbleData.VarIdNull if the data object is a literal and therefore refers to no variable.

getReferents

public java.util.BitSet getReferents()
Retrieve the Ids of the variables to which this data object refers, if any. Must be overriden by subclasses which can refer to variables.
Returns:
The Ids of the variables to which this data object refers, or AbleData.VarIdNull if the data object is a literal and therefore refers to no variable.

getDataType

public int getDataType()
Retrieve the data type of this data object.
Overrides:
getDataType in class AbleLhs
Returns:
An AbleData.<DataType> constant.

arlCRdString

public java.lang.String arlCRdString()
Return a formal rule language "clause" string that describes this data object.
Overrides:
arlCRdString in class AbleLhs
Returns:
A String describing the data object in formal rule language.

xmlCRdString

public java.lang.String xmlCRdString()
Return a formal XML "read clause" string that describes this data object; for example, "very, very hot".
Overrides:
xmlCRdString in class AbleLhs
Returns:
A String describing the data object in XML.

cmpEq

public boolean cmpEq(AbleRd theRhs)
              throws AbleDataException
Comparison, equal to: compare the current value of this data object to the current value of theRhs.

"==" is used for numeric and boolean compares; equals() is used for Object compares; and Collator.equals() is used for String compares.

Overrides:
cmpEq in class AbleLhs
Parameters:
theRhs - The right-hand side of the comparison.

Returns:
true, if this data object is equal to theRhs; false, otherwise.
Throws:
AbleDataException - If the right-hand side cannot be converted (if necessary) and compared to this data object.

cmpGt

public boolean cmpGt(AbleRd theRhs)
              throws AbleDataException
Comparison, greater than: compare the current value of this data object to the current value of theRhs.

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

Overrides:
cmpGt in class AbleLhs
Parameters:
theRhs - The right-hand side of the comparison.

Returns:
true, if this data object is greater than theRhs; false, otherwise.
Throws:
AbleDataException - If the right-hand side cannot be converted (if necessary) and compared to this data object.

cmpGtEq

public boolean cmpGtEq(AbleRd theRhs)
                throws AbleDataException
Comparison, greater than or equal to: compare the current value of this data object to the current value of theRhs.

">=" 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.

Overrides:
cmpGtEq in class AbleLhs
Parameters:
theRhs - The right-hand side of the comparison.

Returns:
true, if this data object is greater than or equal to theRhs; false, otherwise.
Throws:
AbleDataException - If the right-hand side cannot be converted (if necessary) and compared to this data object.

cmpLt

public boolean cmpLt(AbleRd theRhs)
              throws AbleDataException
Comparison, less than: compare the current value of this data object to the current value of theRhs.

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

Overrides:
cmpLt in class AbleLhs
Parameters:
theRhs - The right-hand side of the comparison.

Returns:
true, if this data object is less than theRhs; false, otherwise.
Throws:
AbleDataException - If the right-hand side cannot be converted (if necessary) and compared to this data object.

cmpLtEq

public boolean cmpLtEq(AbleRd theRhs)
                throws AbleDataException
Comparison, less than or equal to: compare the current value of this data object to the current value of theRhs.

"<=" 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.

Overrides:
cmpLtEq in class AbleLhs
Parameters:
theRhs - The right-hand side of the comparison.

Returns:
true, if this data object is less than or equal to theRhs; false, otherwise.
Throws:
AbleDataException - If the right-hand side cannot be converted (if necessary) and compared to this data object.

cmpNeq

public boolean cmpNeq(AbleRd theRhs)
               throws AbleDataException
Comparison, not equal to: compare the current value of this data object to the current value of theRhs.

"!=" is used for numeric and boolean compares; ! equals() is used for Object compares; and ! Collator.equals() is used for String compares.

Overrides:
cmpNeq in class AbleLhs
Parameters:
theRhs - The right-hand side of the comparison.

Returns:
true, if this data object is not equal to theRhs; false, otherwise.
Throws:
AbleDataException - If the right-hand side cannot be converted (if necessary) and compared to this data object.

compPlus

public AbleLiteral compPlus(AbleRd theRhs)
                     throws AbleDataException
Compute, add or concatenate the current value of this data object to the current value of theRhs.

"+" is used for numeric addtion and String concatenation.

Overrides:
compPlus in class AbleLhs
Parameters:
theRhs - The right-hand side of the comparison.

Returns:
The result of the addition or concatenation operation.
Throws:
AbleDataException - If the right-hand side cannot be converted (if necessary) and compared to this data object.

compMinus

public AbleLiteral compMinus(AbleRd theRhs)
                      throws AbleDataException
Compute, subtract the current value of theRhs from the current value of this object.

"-" is used for numeric subtraction.

Overrides:
compMinus in class AbleLhs
Parameters:
theRhs - The right-hand side of the comparison.

Returns:
The result of the subtraction operation.
Throws:
AbleDataException - If the right-hand side cannot be converted (if necessary) and compared to this data object.

compMultiply

public AbleLiteral compMultiply(AbleRd theRhs)
                         throws AbleDataException
Compute, multiply the current value of this data object to the current value of theRhs.

"*" is used for numeric multiplication.

Overrides:
compMultiply in class AbleLhs
Parameters:
theRhs - The right-hand side of the comparison.

Returns:
The result of the multiplication operation.
Throws:
AbleDataException - If the right-hand side cannot be converted (if necessary) and compared to this data object.

compDivide

public AbleLiteral compDivide(AbleRd theRhs)
                       throws AbleDataException
Compute, divide the current value of this data object by the current value of theRhs.

"/" is used for numeric division.

Overrides:
compDivide in class AbleLhs
Parameters:
theRhs - The right-hand side of the comparison.

Returns:
The result of the division operation.
Throws:
AbleDataException - If the right-hand side cannot be converted (if necessary) and compared to this data object.

logicalAND

public boolean logicalAND(AbleRd theRhs)
                   throws AbleDataException
Logical AND the current value of this data object with the current value of theRhs.

"&&" is used for boolean AND.

Overrides:
logicalAND in class AbleLhs
Parameters:
theRhs - The right-hand side of the comparison.

Returns:
The result of the logical AND operation.
Throws:
AbleDataException - If the right-hand side cannot be converted (if necessary) and compared to this data object.

logicalOR

public boolean logicalOR(AbleRd theRhs)
                  throws AbleDataException
Logical OR the current value of this data object with the current value of theRhs.

"||" is used for boolean OR.

Overrides:
logicalOR in class AbleLhs
Parameters:
theRhs - The right-hand side of the comparison.

Returns:
The result of the logical OR operation.
Throws:
AbleDataException - If the right-hand side cannot be converted (if necessary) and compared to this data object.

logicalNOT

public boolean logicalNOT(AbleRd theRhs)
                   throws AbleDataException
Logical NOT: complement the current value of this data object.

"!" is used for boolean NOT.

Overrides:
logicalNOT in class AbleLhs
Parameters:
theRhs - The right-hand side of the comparison.

Returns:
The result of the boolean NOT operation.
Throws:
AbleDataException - If the right-hand side cannot be converted (if necessary) and compared to this data object.

setBooleanValue

public void setBooleanValue(boolean theNewValue)
                     throws AbleDataException
Set the value of this data object from a boolean value.
Overrides:
setBooleanValue in class AbleLhs
Parameters:
theNewValue - A boolean value.

Throws:
AbleDataException - If the value of this object cannot be represented as a boolean value.

setFuzzyValue

public void setFuzzyValue(AbleFuzzySet theNewValue)
                   throws AbleDataException
Set the value of this data object from a fuzzy value.
Overrides:
setFuzzyValue in class AbleLhs
Parameters:
theNewValue - A fuzzy set.

Throws:
AbleDataException - If the value of this object cannot be represented as a fuzzy value.

setGenericValue

public void setGenericValue(java.lang.Object theNewValue)
                     throws AbleDataException
Set the value of this data object from an object.
Overrides:
setGenericValue in class AbleLhs
Parameters:
theNewValue - Any type of Object.

Throws:
AbleDataException - If the value of this object cannot be derived from the specified Object.

setNumericValue

public void setNumericValue(double theNewValue)
                     throws AbleDataException
Set the value of this data object from a numeric value.
Overrides:
setNumericValue in class AbleLhs
Parameters:
theNewValue - Any number.

Throws:
AbleDataException - If the value of this object cannot be represented as a numeric value.

setStringValue

public void setStringValue(java.lang.String theNewValue)
                    throws AbleDataException
Set the value of this data object from a string value.
Overrides:
setStringValue in class AbleLhs
Parameters:
theNewValue - A string.

Throws:
AbleDataException - If the value of this object cannot be represented as a string value.

setValue

public void setValue(AbleLiteral theNewValue)
              throws AbleDataException
Set the value of this data object from a literal object.
Overrides:
setValue in class AbleLhs
Parameters:
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.

Throws:
AbleDataException - If the value of this object cannot be determined from the literal object.

arlDclString

public java.lang.String arlDclString()
Return a formal rule language "declaration" string that describes this data object.

This implementation always returns the empty string since fields and field references aren't explicitly declared anywhere.

Overrides:
arlDclString in class AbleLhs
Returns:
A String describing the data object in formal rule language.

xmlDclString

public java.lang.String xmlDclString()
Return a formal XML "declaration" string that describes this data object.

This implementation always returns the empty string since fields and field references aren't explicitly declared anywhere.

Overrides:
xmlDclString in class AbleLhs
Returns:
A String describing the data object in XML.

xmlCWrString

public java.lang.String xmlCWrString()
Return a formal XML "clause write" string that describes this data object.
Overrides:
xmlCWrString in class AbleLhs
Returns:
A String describing the data object in XML.

getTemplateString

public java.lang.String getTemplateString(java.util.Vector theTemplateVars)
Return a formatted ARL text string for use by templates

asgnEq

public void asgnEq(AbleRd theRhs)
            throws AbleDataException
Assignment (boolean): assign the current value of theRhs to this data object.
Overrides:
asgnEq in class AbleLhs
Parameters:
theRhs - The right-hand, or source, side of the assignment.

Throws:
AbleDataException - If the right-hand side cannot be converted (if necessary) and assigned to this data object.

asgnIs

public void asgnIs(AbleRd theRhs)
            throws AbleDataException
Assignment (fuzzy): assign the current value of theRhs to this data object.
Overrides:
asgnIs in class AbleLhs
Parameters:
theRhs - The right-hand, or source, side of the assignment. This must be a fuzzy set.

Throws:
AbleDataException - If the right-hand side cannot be converted (if necessary) and assigned to this data object.

asgnIs

public void asgnIs(AbleRd theRhs,
                   double theTruthValue)
            throws AbleDataException
Assignment (fuzzy): assign the current value of theRhs to this data object, correlated with the specified truth value.
Overrides:
asgnIs in class AbleLhs
Parameters:
theRhs - The right-hand, or source, side of the assignment. This must be a fuzzy set.

theTruthValue - the truth value with which theRhs is correlated.

Throws:
AbleDataException - If the right-hand side cannot be converted (if necessary) and assigned to this data object.

getVariable

public AbleArrayVariable getVariable()

getIndexExpression

public AbleRd getIndexExpression()

getDataTypeClass

public java.lang.Class getDataTypeClass()
Description copied from class: AbleLhs
Retrieve the actual class of this object's underlying data type.
Overrides:
getDataTypeClass in class AbleLhs
Following copied from class: com.ibm.able.data.AbleLhs
Returns:
The class of the underlying data type.

getDataTypeClassName

public java.lang.String getDataTypeClassName()
Description copied from class: AbleLhs
Retrieve the name of the class of this object's underlying data type.
Overrides:
getDataTypeClassName in class AbleLhs
Following copied from class: com.ibm.able.data.AbleLhs
Returns:
A String that is the name of the class of the underlying data type.

toString

public java.lang.String toString()
Retrieve a string describing (the contents of) the object.
Overrides:
toString in class java.lang.Object
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.
Overrides:
traceString in class AbleLhs
Parameters:
theFlavor - An Able.TraceStringFlavor value.

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

Copyright

public static java.lang.String Copyright()
Determine the copyright of this class.
Returns:
A String containing this class's copyright statement.

ABLE 2.0.0 07/02/2003 10:25:01

(C) Copyright IBM Corporation 1999, 2003