ABLE, Version 1.1b

com.ibm.able.data
Class AbleNumericLiteral

java.lang.Object
  |
  +--com.ibm.able.data.AbleLiteral
        |
        +--com.ibm.able.data.AbleNumericLiteral

public class AbleNumericLiteral
extends AbleLiteral
implements java.io.Serializable

This class defines the Able data numeric literal.

Version:
$Revision: 1.5 $, $Date: 2000/08/24 12:13:34 $
See Also:
Serialized Form

Field Summary
protected  double myValue
           
 
Fields inherited from class com.ibm.able.data.AbleLiteral
myDataType
 
Constructor Summary
AbleNumericLiteral(double theValue)
          Create a new literal with the specified value.
 
Method Summary
 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.
static java.lang.String Copyright()
          Determine the copyright of this class.
 boolean getBooleanValue()
          Retrieve the value of this data object as a boolean value.
 AbleLiteral 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.
 AbleLiteral getValue()
          Retrieve the value of this data object as a literal.
 java.lang.String rlCRdString()
          Return a formal rule language "clause read" string that describes this data object.
 java.lang.String toString()
          Retrieve a string describing (the contents of) the object.
 java.lang.String xmlCRdString()
          Return a formal XML "clause read" string that describes this data object.
 
Methods inherited from class com.ibm.able.data.AbleLiteral
cmpIs, getDataType, getDataTypeAsString, getReferent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

myValue

protected double myValue
Constructor Detail

AbleNumericLiteral

public AbleNumericLiteral(double theValue)
Create a new literal with the specified value.
Parameters:
theValue - The value to which this literal is to be set.

Method Detail

getBooleanValue

public boolean getBooleanValue()
                        throws AbleDataException
Retrieve the value of this data object as a boolean value.
Returns:
A boolean, if the value of this object can be represented as a boolean value. If the current value is 0.0, false is returned; otherwise true is returned.
Throws:
AbleDataException - If the value of this object cannot be represented as a boolean value.
Overrides:
getBooleanValue in class AbleLiteral

getFuzzyValue

public AbleLiteral getFuzzyValue()
                          throws AbleDataException
Retrieve the value of this data object as a fuzzy value.
Returns:
A fuzzy set, if the value of this object can be represented as a fuzzy value. This method always throws an exception.
Throws:
AbleDataException - If the value of this object cannot be represented as a fuzzy value.
Overrides:
getFuzzyValue in class AbleLiteral

getGenericValue

public java.lang.Object getGenericValue()
                                 throws AbleDataException
Retrieve the value of this data object as an Object.
Returns:
A Double object.
Throws:
AbleDataException - If the value of this object cannot be represented as an Object.
Overrides:
getGenericValue in class AbleLiteral

getNumericValue

public double getNumericValue()
                       throws AbleDataException
Retrieve the value of this data object as a numeric value.
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.
Overrides:
getNumericValue in class AbleLiteral

getStringValue

public java.lang.String getStringValue()
                                throws AbleDataException
Retrieve the value of this data object as a string value.
Returns:
A String, if the value of this object can be represented as a string value. Double.toString() is used to produce the string.
Throws:
AbleDataException - If the value of this object cannot be represented as a string value.
Overrides:
getStringValue in class AbleLiteral

getValue

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

rlCRdString

public java.lang.String rlCRdString()
Return a formal rule language "clause read" string that describes this data object.
Returns:
A String describing the data object in formal rule language. Double.toString() is used to produce the string.
Overrides:
rlCRdString in class AbleLiteral

xmlCRdString

public java.lang.String xmlCRdString()
Return a formal XML "clause read" string that describes this data object.
Returns:
A String describing the data object in XML. A form similar to "<numericLiteral value=\"n.m\"/>" is returned.
Overrides:
xmlCRdString in class AbleLiteral

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.

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.
Overrides:
cmpEq in class AbleLiteral

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.

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.
Overrides:
cmpGt in class AbleLiteral

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.

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.
Overrides:
cmpGtEq in class AbleLiteral

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.

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.
Overrides:
cmpLt in class AbleLiteral

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.

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.
Overrides:
cmpLtEq in class AbleLiteral

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.

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.
Overrides:
cmpNeq in class AbleLiteral

toString

public java.lang.String toString()
Retrieve a string describing (the contents of) the object.
Returns:
A String containing the current contents of the object.
Overrides:
toString in class AbleLiteral

Copyright

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

ABLE, Version 1.1b

ABLE: Produced by Joe, Don, and Jeff who say, 'Thanks for your support.'