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

com.ibm.able.data
Class AbleBooleanLiteral

java.lang.Object
  |
  +--com.ibm.able.data.AbleLiteral
        |
        +--com.ibm.able.data.AbleBooleanLiteral
All Implemented Interfaces:
AbleRd, java.io.Serializable

public class AbleBooleanLiteral
extends AbleLiteral
implements java.io.Serializable

This class wraps a value of the primitive type boolean in an object. An object of type AbleBooleanLiteral contains a single, immutable field whose type is boolean. Instances of AbleBooleanLiteral are used by the Able rules classes in clauses and expressions. In addition, this class provides methods for converting a boolean to a String value as well as other logical comparison and math operator methods useful when dealing with a boolean.

See Also:
Serialized Form

Field Summary
static AbleBooleanLiteral FALSE
           
protected  boolean myValue
          The immutable value of this literal.
static AbleBooleanLiteral TRUE
           
 
Constructor Summary
AbleBooleanLiteral(boolean theValue)
          Create a new literal with the specified value.
 
Method Summary
 java.lang.String arlCRdString()
          Return a formal ARL "clause read" string that describes 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 cmpNeq(AbleRd theRhs)
          Comparison, not equal to: compare the current value of this data object to the current value of theRhs.
 boolean equals(java.lang.Object theOtherObject)
           
 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.
 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.
 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.
 java.lang.String traceString(int theTraceStringFlavor)
          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
bitwiseAND, bitwiseNOT, bitwiseOR, bitwiseShiftLeft, bitwiseShiftRight, bitwiseShiftRightZeroFill, cmpGt, cmpGtEq, cmpIs, cmpLt, cmpLtEq, compDivide, compMinus, compModulo, compMultiply, compPlus, compUnaryMinus, Copyright, getDataTypeAsString, getReferent, getReferents, getTemplateString, isConstant
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

myValue

protected boolean myValue
The immutable value of this literal.

TRUE

public static final AbleBooleanLiteral TRUE

FALSE

public static final AbleBooleanLiteral FALSE
Constructor Detail

AbleBooleanLiteral

public AbleBooleanLiteral(boolean 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.
Overrides:
getBooleanValue in class AbleLiteral
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 AbleLiteral
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.

getGenericValue

public java.lang.Object getGenericValue()
                                 throws AbleDataException
Retrieve the value of this data object as an Object.
Overrides:
getGenericValue in class AbleLiteral
Returns:
A Boolean object.
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 AbleLiteral
Returns:
A double, if the value of this object can be represented as a numeric value. If the current value is true, 1.0 is returned; otherwise 0.0 is returned.
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 AbleLiteral
Returns:
A String, if the value of this object can be represented as a string value. If the current value is true, "True" is returned; otherwise "False" is returned.
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 AbleLiteral
Returns:
An AbleBooleanLiteral object.
Throws:
AbleDataException - If the value of this object cannot be represented as a literal.

getDataTypeClass

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

getDataTypeClassName

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

arlCRdString

public java.lang.String arlCRdString()
Return a formal ARL "clause read" string that describes this data object.
Overrides:
arlCRdString in class AbleLiteral
Returns:
A String describing the data object in formal rule language. If the current value is true, "True" is returned; otherwise "False" is returned.

xmlCRdString

public java.lang.String xmlCRdString()
Return a formal XML "clause read" string that describes this data object.
Overrides:
xmlCRdString in class AbleLiteral
Returns:
A String describing the data object in XML. If the current value is true, "<booleanLiteral value=\"true\"/>" is returned; otherwise "<booleanLiteral value=\"false\"/>" is returned.

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

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

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

bitwiseXOR

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

"^" is used for bitwise or logical XOR.

Overrides:
bitwiseXOR in class AbleLiteral
Parameters:
theRhs - The right-hand side of the operation.

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

equals

public boolean equals(java.lang.Object theOtherObject)
Overrides:
equals in class java.lang.Object

toString

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

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

getDataType

public int getDataType()
Description copied from class: AbleLiteral
Retrieve the data type of this data object.
Overrides:
getDataType in class AbleLiteral
See Also:
AbleRd.getDataType()

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

(C) Copyright IBM Corporation 1999, 2003