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

com.ibm.able.data
Class AbleLiteral

java.lang.Object
  |
  +--com.ibm.able.data.AbleLiteral
All Implemented Interfaces:
AbleRd, java.io.Serializable
Direct Known Subclasses:
AbleArrayLengthLiteral, AbleArrayLiteral, AbleBooleanLiteral, AbleByteLiteral, AbleCallLiteral, AbleCharacterLiteral, AbleDoubleLiteral, AbleExpression, AbleFloatLiteral, AbleFuzzySet, AbleGenericLiteral, AbleIntegerLiteral, AbleLongLiteral, AbleNewObjectLiteral, AbleShortLiteral, AbleStringLiteral, AbleTimeStampLiteral

public abstract class AbleLiteral
extends java.lang.Object
implements AbleRd, java.io.Serializable

This class defines an abstract base class for constant values and the operations on those values.

See Also:
Serialized Form

Constructor Summary
protected AbleLiteral()
          Create a new literal of the specified type.
 
Method Summary
abstract  java.lang.String arlCRdString()
          Return a formal ARL "clause read" string that describes this data object.
 AbleLiteral bitwiseAND(AbleRd theRhs)
          Bitwise AND the current value of this data object with the current value of theRhs.
 AbleLiteral bitwiseNOT(AbleRd theRhs)
          Bitwise NOT: complement the current value of this data object.
 AbleLiteral bitwiseOR(AbleRd theRhs)
          Bitwise OR the current value of this data object with the current value of theRhs.
 AbleLiteral bitwiseShiftLeft(AbleRd theRhs)
          Bitwise Shift Left the current value of this data object by the current value of theRhs.
 AbleLiteral bitwiseShiftRight(AbleRd theRhs)
          Bitwise Shift Right the current value of this data object by the current value of theRhs.
 AbleLiteral bitwiseShiftRightZeroFill(AbleRd theRhs)
          Bitwise Shift Right with Zero Fill the current value of this data object by the current value of theRhs.
 AbleLiteral bitwiseXOR(AbleRd theRhs)
          Bitwise 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.
 double cmpIs(AbleRd theRhs)
          Comparison, fuzzy 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 compModulo(AbleRd theRhs)
          Compute, modulo - return the remainder of a divide the current int value of this data object by the current value of theRhs.
 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.
abstract  boolean getBooleanValue()
          Retrieve the value of this data object as a boolean value.
abstract  int getDataType()
          Retrieve the data type of this data object.
 java.lang.String getDataTypeAsString()
          Retrieve the type of this data object as a human-readable string.
abstract  java.lang.Class getDataTypeClass()
          Retrieve the actual class of this object's underlying data type.
abstract  java.lang.String getDataTypeClassName()
          Retrieve the name of the class of this object's underlying data type.
abstract  AbleFuzzySet getFuzzyValue()
          Retrieve the value of this data object as a fuzzy value.
abstract  java.lang.Object getGenericValue()
          Retrieve the value of this data object as an Object.
abstract  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.
abstract  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
abstract  AbleLiteral getValue()
          Retrieve the value of this data object as a literal.
 boolean isConstant()
          Returns true if this AbleRd object is a constant value false, if it does not.
 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.
 java.lang.String toString()
          Retrieve a string describing (the contents of) the object.
abstract  java.lang.String traceString(int theTraceStringFlavor)
          Retrieve a string describing (the contents of) the object.
abstract  java.lang.String xmlCRdString()
          Return a formal XML "clause read" string that describes this data object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AbleLiteral

protected AbleLiteral()
Create a new literal of the specified type.
Parameters:
theDataType - An AbleData.<DataType> constant.

Method Detail

getBooleanValue

public abstract boolean getBooleanValue()
                                 throws AbleDataException
Retrieve the value of this data object as a boolean value.
Specified by:
getBooleanValue in interface AbleRd
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 abstract AbleFuzzySet getFuzzyValue()
                                    throws AbleDataException
Retrieve the value of this data object as a fuzzy value.
Specified by:
getFuzzyValue in interface AbleRd
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 abstract java.lang.Object getGenericValue()
                                          throws AbleDataException
Retrieve the value of this data object as an Object.
Specified by:
getGenericValue in interface AbleRd
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 abstract double getNumericValue()
                                throws AbleDataException
Retrieve the value of this data object as a numeric value.
Specified by:
getNumericValue in interface AbleRd
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 abstract java.lang.String getStringValue()
                                         throws AbleDataException
Retrieve the value of this data object as a string value.
Specified by:
getStringValue in interface AbleRd
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 abstract AbleLiteral getValue()
                              throws AbleDataException
Retrieve the value of this data object as a literal.
Specified by:
getValue in interface AbleRd
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.
Specified by:
getReferent in interface AbleRd
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.
Specified by:
getReferents in interface AbleRd
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 abstract int getDataType()
Retrieve the data type of this data object.
Specified by:
getDataType in interface AbleRd
Returns:
An AbleData.<DataType> constant.

getDataTypeClass

public abstract java.lang.Class getDataTypeClass()
Retrieve the actual class of this object's underlying data type.
Specified by:
getDataTypeClass in interface AbleRd
Returns:
The class of the underlying data type.

getDataTypeClassName

public abstract java.lang.String getDataTypeClassName()
Retrieve the name of the class of this object's underlying data type.
Specified by:
getDataTypeClassName in interface AbleRd
Returns:
A String that is the name of the class of the underlying data type.

arlCRdString

public abstract java.lang.String arlCRdString()
Return a formal ARL "clause read" string that describes this data object.
Specified by:
arlCRdString in interface AbleRd
Returns:
A String describing the data object in formal rule language.

xmlCRdString

public abstract java.lang.String xmlCRdString()
Return a formal XML "clause read" string that describes this data object.
Specified by:
xmlCRdString in interface AbleRd
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
Specified by:
getTemplateString in interface AbleRd

traceString

public abstract java.lang.String traceString(int theTraceStringFlavor)
Retrieve a string describing (the contents of) the object.
Specified by:
traceString in interface AbleRd
Parameters:
theFlavor - An AbleRuleSet.TraceStringFlavor value.

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

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.

Specified by:
cmpEq in interface AbleRd
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.

Specified by:
cmpGt in interface AbleRd
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.

Specified by:
cmpGtEq in interface AbleRd
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.

cmpIs

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

Fuzzy membership is used for the compare.

Specified by:
cmpIs in interface AbleRd
Parameters:
theRhs - The right-hand side of the comparison. This must be a fuzzy set.

Returns:
The membership of the fuzzy variable's crisp value within the fuzzy ste.
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.

Specified by:
cmpLt in interface AbleRd
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.

Specified by:
cmpLtEq in interface AbleRd
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.

Specified by:
cmpNeq in interface AbleRd
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.

Specified by:
compPlus in interface AbleRd
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.

Specified by:
compMinus in interface AbleRd
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.

Specified by:
compMultiply in interface AbleRd
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.

Specified by:
compDivide in interface AbleRd
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.

compModulo

public AbleLiteral compModulo(AbleRd theRhs)
                       throws AbleDataException
Compute, modulo - return the remainder of a divide the current int value of this data object by the current value of theRhs.

"%" is tom compute the remainder of an integer division.

Specified by:
compModulo in interface AbleRd
Parameters:
theRhs - The right-hand side of the operation.

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

compUnaryMinus

public AbleLiteral compUnaryMinus(AbleRd theRhs)
                           throws AbleDataException
Compute, the unary minus of the current value of this object.

"-" is used for numeric negation.

Specified by:
compUnaryMinus in interface AbleRd
Parameters:
theRhs - The right-hand side of the operation (ignored).

Returns:
The result of the negation operation.
Throws:
AbleDataException - If the value of this data object cannot be negated.

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.

Specified by:
logicalAND in interface AbleRd
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.

Specified by:
logicalOR in interface AbleRd
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.

Specified by:
logicalNOT in interface AbleRd
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.

bitwiseAND

public AbleLiteral bitwiseAND(AbleRd theRhs)
                       throws AbleDataException
Bitwise AND the current value of this data object with the current value of theRhs.

"&" is used for bitwise AND.

Specified by:
bitwiseAND in interface AbleRd
Parameters:
theRhs - The right-hand side of the operation.

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

bitwiseOR

public AbleLiteral bitwiseOR(AbleRd theRhs)
                      throws AbleDataException
Bitwise OR the current value of this data object with the current value of theRhs.

"|" is used for bitwise OR.

Specified by:
bitwiseOR in interface AbleRd
Parameters:
theRhs - The right-hand side of the operation.

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

bitwiseXOR

public AbleLiteral bitwiseXOR(AbleRd theRhs)
                       throws AbleDataException
Bitwise XOR: exclusive OR the current value of this data object with the current value of theRhs.

"^" is used for bitwise XOR.

Specified by:
bitwiseXOR in interface AbleRd
Parameters:
theRhs - The right-hand side of the operation.

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

bitwiseNOT

public AbleLiteral bitwiseNOT(AbleRd theRhs)
                       throws AbleDataException
Bitwise NOT: complement the current value of this data object.

"~" is used for bitwise NOT or complement.

Specified by:
bitwiseNOT in interface AbleRd
Parameters:
theRhs - The right-hand side of the operation.

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

bitwiseShiftLeft

public AbleLiteral bitwiseShiftLeft(AbleRd theRhs)
                             throws AbleDataException
Bitwise Shift Left the current value of this data object by the current value of theRhs.

"&&" is used for boolean AND.

Specified by:
bitwiseShiftLeft in interface AbleRd
Parameters:
theRhs - The right-hand side of the operation.

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

bitwiseShiftRight

public AbleLiteral bitwiseShiftRight(AbleRd theRhs)
                              throws AbleDataException
Bitwise Shift Right the current value of this data object by the current value of theRhs.

">>" is used for bitwise shift right.

Specified by:
bitwiseShiftRight in interface AbleRd
Parameters:
theRhs - The right-hand side of the operation.

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

bitwiseShiftRightZeroFill

public AbleLiteral bitwiseShiftRightZeroFill(AbleRd theRhs)
                                      throws AbleDataException
Bitwise Shift Right with Zero Fill the current value of this data object by the current value of theRhs.

">>" is used for bitwise shift right with zero fill.

Specified by:
bitwiseShiftRightZeroFill in interface AbleRd
Parameters:
theRhs - The right-hand side of the operation.

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

isConstant

public boolean isConstant()
Description copied from interface: AbleRd
Returns true if this AbleRd object is a constant value false, if it does not.
Specified by:
isConstant in interface AbleRd

getDataTypeAsString

public java.lang.String getDataTypeAsString()
Retrieve the type of this data object as a human-readable string.
Returns:
An AbleData.<DataType> constant turned into a formatted string.

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.

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