ABLE, Version 1.1b

com.ibm.able.data
Class AbleLhs

java.lang.Object
  |
  +--com.ibm.able.data.AbleLhs
Direct Known Subclasses:
AbleVariable

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

This class defines the base class from which all data objects that can appear on the lefthand side of a clause must inherit. This base data object implements both the "readable" and "writable" interfaces.

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

Constructor Summary
AbleLhs()
           
 
Method Summary
 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.
 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.
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.
abstract  AbleLiteral 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.
abstract  int getReferent()
          Retrieve the Id of the variable to which this data object refers, if any.
abstract  java.lang.String getStringValue()
          Retrieve the value of this data object as a string value.
abstract  AbleLiteral getValue()
          Retrieve the value of this data object as a literal.
abstract  java.lang.String rlCRdString()
          Return a formal rule language "clause" string that describes this data object.
abstract  java.lang.String rlDclString()
          Return a formal rule language "declaration" string that describes this data object.
abstract  void setBooleanValue(boolean theNewValue)
          Set the value of this data object from a boolean value.
abstract  void setFuzzyValue(AbleLiteral theNewValue)
          Set the value of this data object from a fuzzy value.
abstract  void setGenericValue(java.lang.Object theNewValue)
          Set the value of this data object from an object.
abstract  void setNumericValue(double theNewValue)
          Set the value of this data object from a numeric value.
abstract  void setStringValue(java.lang.String theNewValue)
          Set the value of this data object from a string value.
abstract  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.
abstract  java.lang.String xmlCRdString()
          Return a formal XML "read clause" string that describes this data object; for example, "very, very hot".
abstract  java.lang.String xmlCWrString()
          Return a formal XML "clause write" string that describes this data object.
abstract  java.lang.String xmlDclString()
          Return a formal XML "declaration" 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

AbleLhs

public AbleLhs()
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 AbleLiteral 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 abstract 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.

getDataType

public abstract int getDataType()
Retrieve the data type of this data object.
Specified by:
getDataType in interface AbleRd
Returns:
An AbleData.<DataType> constant.

rlCRdString

public abstract java.lang.String rlCRdString()
Return a formal rule language "clause" string that describes this data object.
Specified by:
rlCRdString 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 "read clause" string that describes this data object; for example, "very, very hot".
Specified by:
xmlCRdString in interface AbleRd
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.

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.

setBooleanValue

public abstract void setBooleanValue(boolean theNewValue)
                              throws AbleDataException
Set the value of this data object from a boolean value.
Specified by:
setBooleanValue in interface AbleWr
Parameters:
theNewValue - A boolean value.

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

setFuzzyValue

public abstract void setFuzzyValue(AbleLiteral theNewValue)
                            throws AbleDataException
Set the value of this data object from a fuzzy value.
Specified by:
setFuzzyValue in interface AbleWr
Parameters:
theNewValue - A fuzzy set.

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

setGenericValue

public abstract void setGenericValue(java.lang.Object theNewValue)
                              throws AbleDataException
Set the value of this data object from an object.
Specified by:
setGenericValue in interface AbleWr
Parameters:
theNewValue - Any type of Object.

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

setNumericValue

public abstract void setNumericValue(double theNewValue)
                              throws AbleDataException
Set the value of this data object from a numeric value.
Specified by:
setNumericValue in interface AbleWr
Parameters:
theNewValue - Any number.

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

setStringValue

public abstract void setStringValue(java.lang.String theNewValue)
                             throws AbleDataException
Set the value of this data object from a string value.
Specified by:
setStringValue in interface AbleWr
Parameters:
theNewValue - A string.

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

setValue

public abstract void setValue(AbleLiteral theNewValue)
                       throws AbleDataException
Set the value of this data object from a literal object.
Specified by:
setValue in interface AbleWr
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.

rlDclString

public abstract java.lang.String rlDclString()
Return a formal rule language "declaration" string that describes this data object.
Specified by:
rlDclString in interface AbleWr
Returns:
A String describing the data object in formal rule language.

xmlDclString

public abstract java.lang.String xmlDclString()
Return a formal XML "declaration" string that describes this data object.
Specified by:
xmlDclString in interface AbleWr
Returns:
A String describing the data object in XML.

xmlCWrString

public abstract java.lang.String xmlCWrString()
Return a formal XML "clause write" string that describes this data object.
Specified by:
xmlCWrString in interface AbleWr
Returns:
A String describing the data object in XML.

asgnEq

public void asgnEq(AbleRd theRhs)
            throws AbleDataException
Assignment (boolean): assign the current value of theRhs to this data object.
Specified by:
asgnEq in interface AbleWr
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.
Specified by:
asgnIs in interface AbleWr
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.
Specified by:
asgnIs in interface AbleWr
Parameters:
theRhs - The right-hand, or source, side of the assignment. This must be a fuzzy set.

theTruthValue -

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

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 java.lang.Object

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