|
ABLE, Version 1.1b | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.ibm.able.data.AbleLhs | +--com.ibm.able.data.AbleVariable | +--com.ibm.able.data.AbleCategoricalVariable
This class defines the Able data categorical variable.
Categorical variables are essentially string variables, but rather than assuming any arbitrary string as the current value, a categorical variable can be assigned only 1 of N pre-defined strings, or categories.
Field Summary | |
protected java.lang.String |
myValue
|
protected java.lang.String |
myValueInitial
|
protected java.util.Vector |
myValueList
|
Fields inherited from class com.ibm.able.data.AbleVariable |
myChgSupport,
myContext,
myDataType,
myId,
myName,
myReferences |
Constructor Summary | |
AbleCategoricalVariable(java.lang.Object theContext,
java.beans.PropertyChangeSupport theChgSupport,
int theId,
java.lang.String theName)
Create a new categorical variable. |
|
AbleCategoricalVariable(java.lang.Object theContext,
java.beans.PropertyChangeSupport theChgSupport,
int theId,
java.lang.String theName,
java.util.Vector theValueList)
Create a new categorical variable over the specified categories. |
|
AbleCategoricalVariable(java.lang.String theName,
java.util.Vector theValueList)
Create a new categorical variable over the specified categories. |
Method Summary | |
void |
addValue(java.lang.String theValue)
Add a value to the list of pre-defined values. |
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. |
int |
getIndexOf(java.lang.String theValue)
Retrieve the index of a value in the list of pre-defined values. |
java.lang.String |
getInitialValue()
Retrieve the variable's initial value. |
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 |
getValueAt(int theIndex)
Retrieve the value at a specific location in the list of pre-defined values. |
java.util.Vector |
getValueList()
Retrieve the list of pre-defined values for this variable. |
int |
getValueListSize()
Retrieve the number of pre-defined values for this variable. |
java.lang.String |
getValueString()
Retrieve the variable's current value as a string. |
void |
removeValue(java.lang.String theValue)
Remove a value from the list of pre-defined values. |
void |
reset()
Reset the variable to its intial state. |
java.lang.String |
rlDclString()
Return a formal rule language "declaration" string that describes this data object. |
void |
setBooleanValue(boolean theNewValue)
Set the value of this data object from a boolean value. |
void |
setFuzzyValue(AbleLiteral theNewValue)
Set the value of this data object from a fuzzy value. |
void |
setGenericValue(java.lang.Object theNewValue)
Set the value of this data object from an object. |
void |
setNumericValue(double theNewValue)
Set the value of this data object from a numeric value. |
void |
setStringValue(java.lang.String theNewValue)
Set the value of this data object from a string value. |
void |
setValue(AbleLiteral theNewValue)
Set the value of this data object from a literal object. |
void |
setValueList(java.util.Vector theNewValueList)
Set the list of pre-defined values, any one of which may be assigned to the current value of this variable. |
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. |
boolean |
valueExist(java.lang.String theValue)
Determine whether a value exists in the list of pre-defined values. |
java.lang.String |
xmlCWrString()
Return a formal XML "clause write" string that describes this data object. |
java.lang.String |
xmlDclString()
Return a formal XML "declaration" string that describes this data object. |
Methods inherited from class com.ibm.able.data.AbleVariable |
getChgSupport,
getContext,
getDataType,
getDataTypeAsString,
getId,
getName,
getReferences,
getReferent,
rlCRdString,
setChgSupport,
setContext,
setId,
setReferences,
xmlCRdString |
Methods inherited from class com.ibm.able.data.AbleLhs |
asgnEq,
asgnIs,
asgnIs,
cmpIs |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
Field Detail |
protected java.lang.String myValue
protected java.lang.String myValueInitial
protected java.util.Vector myValueList
Constructor Detail |
public AbleCategoricalVariable(java.lang.Object theContext, java.beans.PropertyChangeSupport theChgSupport, int theId, java.lang.String theName, java.util.Vector theValueList)
The initial value of this variable cannot be specified and is set to AbleData.StringNull.
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.
theValueList
- A list of categories (String objects), any one of
which can be the current value of this variable.
The list is cloned.
public AbleCategoricalVariable(java.lang.Object theContext, java.beans.PropertyChangeSupport theChgSupport, int theId, java.lang.String theName)
The initial value of this variable cannot be specified and is set to AbleData.StringNull.
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.
public AbleCategoricalVariable(java.lang.String theName, java.util.Vector theValueList)
The initial value of this variable cannot be specified and is set to AbleData.StringNull.
theName
- The unique name of the variable.
theValueList
- A list of categories (String objects), any one of
which can be the current value of this variable.
The list is cloned.
Method Detail |
public boolean getBooleanValue() throws AbleDataException
public AbleLiteral getFuzzyValue() throws AbleDataException
public java.lang.Object getGenericValue() throws AbleDataException
public double getNumericValue() throws AbleDataException
public java.lang.String getStringValue() throws AbleDataException
public AbleLiteral getValue() throws AbleDataException
public boolean cmpEq(AbleRd theRhs) throws AbleDataException
"==" is used for numeric and boolean compares; equals() is used for Object compares; and Collator.equals() is used for String compares.
theRhs
- The right-hand side of the comparison.
public boolean cmpGt(AbleRd theRhs) throws AbleDataException
">" 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.
theRhs
- The right-hand side of the comparison.
public boolean cmpGtEq(AbleRd theRhs) throws AbleDataException
">=" 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.
theRhs
- The right-hand side of the comparison.
public boolean cmpLt(AbleRd theRhs) throws AbleDataException
"<" 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.
theRhs
- The right-hand side of the comparison.
public boolean cmpLtEq(AbleRd theRhs) throws AbleDataException
"<=" 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.
theRhs
- The right-hand side of the comparison.
public boolean cmpNeq(AbleRd theRhs) throws AbleDataException
"!=" is used for numeric and boolean compares; ! equals() is used for Object compares; and ! Collator.equals() is used for String compares.
theRhs
- The right-hand side of the comparison.
public void setBooleanValue(boolean theNewValue) throws AbleDataException
theNewValue
- A boolean value.
If the new value is true the variable is set to
"True", but only if "True" is a valid pre-defined
category for this variable;
if the new value is false the variable is set to
"False", but only if "False" is a valid pre-defined
category;
in all other cases an exception is thrown.
public void setFuzzyValue(AbleLiteral theNewValue) throws AbleDataException
theNewValue
- A fuzzy set.
public void setGenericValue(java.lang.Object theNewValue) throws AbleDataException
theNewValue
- Any type of Object.
public void setNumericValue(double theNewValue) throws AbleDataException
theNewValue
- Any number.
The number is converted to a string and the variable
is set to that string, but only if the string is a
pre-defined category of the variable;
otherwise an exception is thrown.
public void setStringValue(java.lang.String theNewValue) throws AbleDataException
theNewValue
- A string.
The variable is set to the value of the string, but
only if the string is a pre-defined category of the
variable;
otherwise an exception is thrown.
public void setValue(AbleLiteral theNewValue) throws AbleDataException
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.
public java.lang.String rlDclString()
public java.lang.String xmlDclString()
public java.lang.String xmlCWrString()
public void setValueString(java.lang.String theNewValue) throws AbleDataException
public java.lang.String getValueString()
public void reset()
public java.lang.String getInitialValue()
public void setValueList(java.util.Vector theNewValueList)
If the current value of this variable does not appear in the new value list, the current value is set to AbleData.StringNull.
theNewValueList
- A list where each element is a String object.
The input list is cloned and saved.
public java.util.Vector getValueList()
public int getValueListSize()
public boolean valueExist(java.lang.String theValue)
theValue
- A value whose existence in the list of pre-defined
values is to be determined.
public void addValue(java.lang.String theValue) throws AbleDataException
theValue
- A value to add to the list of pre-defined values.
public void removeValue(java.lang.String theValue) throws AbleDataException
If the current value of this variable corresponds to the value being removed, the current value is set to AbleData.StringNull.
theValue
- A value to remove from the list of pre-defined
values.
public int getIndexOf(java.lang.String theValue) throws AbleDataException
theValue
- A value whose index is to be returned.
public java.lang.String getValueAt(int theIndex) throws AbleDataException
theIndex
- The location whose value is to be returned.
public java.lang.String toString()
public static java.lang.String Copyright()
|
ABLE, Version 1.1b | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |