ABLE, Version 1.1b

com.ibm.able.data
Class AbleVariable

java.lang.Object
  |
  +--com.ibm.able.data.AbleLhs
        |
        +--com.ibm.able.data.AbleVariable
Direct Known Subclasses:
AbleBooleanVariable, AbleCategoricalVariable, AbleContinuousVariable, AbleDiscreteVariable, AbleGenericVariable, AbleNumericVariable, AbleStringVariable

public abstract class AbleVariable
extends AbleLhs
implements java.io.Serializable

This class defines the base Able data variable object.

Version:
$Revision: 1.7 $, $Date: 2000/09/26 14:27:10 $
See Also:
Serialized Form

Field Summary
protected  java.beans.PropertyChangeSupport myChgSupport
          A set of listeners interested in property changes performed by this variable.
protected  java.lang.Object myContext
          The context in which this variable is used.
protected  int myDataType
          An AbleData.<DataType> constant that specifies this particular variable's data type.
protected  int myId
          The unique Id of this particular variable.
protected  java.lang.String myName
          The unique name of this particular variable.
protected  AbleReferences myReferences
          A set of references to this variable.
 
Constructor Summary
protected AbleVariable(int theDataType, java.lang.Object theContext, java.beans.PropertyChangeSupport theChgSupport, int theId, java.lang.String theName)
          Create a new variable of the specified type.
protected AbleVariable(int theDataType, java.lang.String theName)
          Create a new variable of the specified type.
 
Method Summary
static java.lang.String Copyright()
          Determine the copyright of this class.
 java.lang.Object getChgSupport()
          Retrieve a reference to the property change support object that this variable uses to notify listeners of changes to this variable's current value.
 java.lang.Object getContext()
          Retrieve a reference to the context in which this variable resides.
 int getDataType()
          Retrieve the data type of this data object.
 java.lang.String getDataTypeAsString()
          Retrieve the data type of this variable as a human-readable debug string.
 int getId()
          Retrieve the unique Id of this variable.
 java.lang.String getName()
          Retrieve the unique name of this variable.
 AbleReferences getReferences()
          Retrieve the set of objects that refer to this variable.
 int getReferent()
          Retrieve the Id of the variable to which this data object refers, if any.
abstract  java.lang.String getValueString()
          Retrieve the variable's current value as a string.
abstract  void reset()
          Reset the variable to its intial state.
 java.lang.String rlCRdString()
          Return a formal rule language "clause read" string that describes this data object.
abstract  java.lang.String rlDclString()
          Return a formal rule language "declaration" string that describes this data object.
 void setChgSupport(java.beans.PropertyChangeSupport theChgSupport)
          Set a reference to the property change support object that this variable uses to notify listeners of changes to this variable's current value.
 void setContext(java.lang.Object theContext)
          Set a reference to the context in which this variable resides.
 void setId(int theId)
          Set the unique Id of this variable.
 void setReferences(AbleReferences theReferences)
          Set the set of objects that refer to this variable.
abstract  void setValueString(java.lang.String theNewValue)
          Set the variable's current value from a string.
 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.
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 com.ibm.able.data.AbleLhs
asgnEq, asgnIs, asgnIs, cmpEq, cmpGt, cmpGtEq, cmpIs, cmpLt, cmpLtEq, cmpNeq, getBooleanValue, getFuzzyValue, getGenericValue, getNumericValue, getStringValue, getValue, setBooleanValue, setFuzzyValue, setGenericValue, setNumericValue, setStringValue, setValue
 
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 variable's data type.

This field is initialized to AbleData.DataTypeUnknown.


myId

protected int myId
The unique Id of this particular variable.

Note that, in some situations, variables may not need any Id at all so it may not matter whether the Id is unique or even exists. However, in other situations, such as when variables are used in rules manipulated by an inference engine, the Id must be guaranteed to be unique. Currently, it is up to the creator of any variable to set the Id appropriately, but this may change in the future.

This field is initialized to 0 (zero).


myName

protected java.lang.String myName
The unique name of this particular variable.

Note that in some situations, variables may not need any name at all so it may not matter whether the name is unique or even exists. However, in other situations, such as when variables are used in rules manipulated by an inference engine, the name must be guaranteed to be unique. Therefore, it is up to the creator of any variable to set the name appropriately.

It is strongly suggested that a name be provided for each and every variable, as the name will appear in various Able windows.

This field is initialized to the empty string ("").


myContext

protected java.lang.Object myContext
The context in which this variable is used.

In some cases, a context is not needed and may be null. In other cases, such as when a variable is used in rules manipulated by an inference engine, the context must be provided. Currently, it is up to the creator of any variable to set the context appropriately.

This field is initialized to null.


myReferences

protected AbleReferences myReferences
A set of references to this variable.

This object allows a variable to keep track of other objects that reference it. Whenever a variable updates its "raw" value, the variable will call this object's updateReferences() method so that those other objects may perform special processing.

Note that in some situations a variable may not give a hoot about what other objects reference it. In this case, this set of references may be null or the empty set. It is up to the creator of any variable to set the references appropriately.

This field is initialized to null.


myChgSupport

protected java.beans.PropertyChangeSupport myChgSupport
A set of listeners interested in property changes performed by this variable.

This object allows a variable to keep track of other objects that are interested in the variable's property changes. Whenever a variable updates its "raw" value, the variable will call this object's firePropertyChange() method so that those other objects may perform special processing.

Note that in some situations nothing may care about property changes. In this case, this set of listeners may be null. It is up to the creator of any variable to set the change support appropriately.

This field is initialized to null.

Constructor Detail

AbleVariable

protected AbleVariable(int theDataType,
                       java.lang.Object theContext,
                       java.beans.PropertyChangeSupport theChgSupport,
                       int theId,
                       java.lang.String theName)
Create a new variable of the specified type.
Parameters:
theDataType - An AbleData.<DataType> constant.

theContext - The context in which this variable resides. May be an Able ruleset, for example, or null if the variable is not part of any context.

theChgSupport - For throwing property change events. This may be null.

theId - The unique Id of the variable.

theName - The unique name of the variable.


AbleVariable

protected AbleVariable(int theDataType,
                       java.lang.String theName)
Create a new variable of the specified type.
Parameters:
theDataType - An AbleData.<DataType> constant.

theName - The unique name of the variable.

Method Detail

getReferent

public int getReferent()
Retrieve the Id of the variable to which this data object refers, if any.
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.
Overrides:
getReferent in class AbleLhs

getDataType

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

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.
Overrides:
rlCRdString in class AbleLhs

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.
Overrides:
xmlCRdString in class AbleLhs

rlDclString

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

xmlDclString

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

xmlCWrString

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

setValueString

public abstract void setValueString(java.lang.String theNewValue)
                             throws AbleDataException
Set the variable's current value from a string. Note: This method is provided for the use of a rule language parser.

getValueString

public abstract java.lang.String getValueString()
Retrieve the variable's current value as a string. Note: This method is provided for the use of a rule language parser.

reset

public abstract void reset()
Reset the variable to its intial state.

getDataTypeAsString

public java.lang.String getDataTypeAsString()
Retrieve the data type of this variable as a human-readable debug string.
Returns:
A String describing the data type of this variable.

setId

public void setId(int theId)
Set the unique Id of this variable.
Parameters:
theId - An integer, which is the unique Id of this variable.

getId

public int getId()
Retrieve the unique Id of this variable.
Returns:
An integer, which is the unique Id of this variable.

getName

public java.lang.String getName()
Retrieve the unique name of this variable.
Returns:
A string, which is the unique name of this variable.

setContext

public void setContext(java.lang.Object theContext)
Set a reference to the context in which this variable resides. Note that this may be null if the variable is not part of any context, such as an inferencing system.
Parameters:
theContext - A reference to an Object, or null.

getContext

public java.lang.Object getContext()
Retrieve a reference to the context in which this variable resides. Note that this may be null if the variable is not part of any context, such as an inferencing system.
Returns:
A reference to an Object, or null.

setChgSupport

public void setChgSupport(java.beans.PropertyChangeSupport theChgSupport)
Set a reference to the property change support object that this variable uses to notify listeners of changes to this variable's current value. Note that this may be null if no property change support object is needed.
Parameters:
theChgSupport - A reference to a PropertyChangeSupport object, or null.

getChgSupport

public java.lang.Object getChgSupport()
Retrieve a reference to the property change support object that this variable uses to notify listeners of changes to this variable's current value. Note that this may be null if no property change support object has been set.
Returns:
A reference to a PropertyChangeSupport object, or null.

setReferences

public void setReferences(AbleReferences theReferences)
Set the set of objects that refer to this variable. Note that this may be null if the variable is used in a context where it doesn't care what other objects might refer to it.
Parameters:
theReferences - A set of Objects that refer to this variable. The set may be the empty set, or null.


getReferences

public AbleReferences getReferences()
Retrieve the set of objects that refer to this variable. Note that this may be null or the empty set.
Returns:
A reference to the set of objects that refer to this variable, or null if no set of objects has been set.

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 AbleLhs

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