|
ABLE 2.0.0 07/02/2003 10:25:01 | ||||||||||
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.AbleContinuousVariable
This class wraps a value of the primitive type double in an object. An object of type AbleContinuousVariable contains a single, mutable field whose type is double. Instances of AbleContinuousVariable are used by the Able rules classes in clauses and expressions. In addition, this class provides methods for converting a double to other datatypes, setting a double value using other datatypes, as well as other logical comparison and math operator methods useful when dealing with a double. *
Field Summary | |
---|---|
protected double |
myDiscourseHi
The maximum value that this variable can assume. |
protected double |
myDiscourseLo
The minimum value that this variable can assume. |
protected double |
myInitialValue
The initial double value used to reset this variable |
protected double |
myValue
The current value of the variable. |
Fields inherited from class com.ibm.able.data.AbleVariable |
---|
myBoundFlag, myChgSupport, myComment, myContext, myDataType, myGlobalFlag, myId, myName, myPrompt, myReferences, myStaticFlag, myTemplateFlag, myValueInitial |
Constructor Summary | |
---|---|
AbleContinuousVariable(double theDiscourseLo,
double theDiscourseHi)
Create a new AbleContinuousVariable to be used as an initializer with the specified universe of discourse. |
|
AbleContinuousVariable(double theDiscourseLo,
double theDiscourseHi,
double theInitialValue)
Create a new AbleContinuousVariable to be used as an initializer with the specified universe of discourse and initial value. |
|
AbleContinuousVariable(java.lang.String theName,
boolean theStaticFlag,
boolean theGlobalFlag,
double theDiscourseLo,
double theDiscourseHi)
Create a new continuous variable with the specified universe of discourse. |
|
AbleContinuousVariable(java.lang.String theName,
double theDiscourseLo,
double theDiscourseHi)
Create a new continuous variable with the specified universe of discourse. |
Method Summary | |
---|---|
java.lang.String |
arlDclString()
Return a formal ARL "declaration" string that describes this data object. |
void |
asgnEq(AbleRd theRhs)
Assignment: assign the current value of theRhs to this data object. |
protected boolean |
chkRange(double theNumber)
|
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. |
AbleLiteral |
compDivide(AbleRd theRhs)
Compute, divide the current value of this data object by the current value of theRhs. |
AbleLiteral |
compMinus(AbleRd theRhs)
Compute, subtract the current value of theRhs from the current value of this object. |
AbleLiteral |
compMultiply(AbleRd theRhs)
Compute, multiply the current value of this data object to the current value of theRhs. |
AbleLiteral |
compPlus(AbleRd theRhs)
Compute, add or concatenate the current value of this data object to the current value of theRhs. |
AbleLiteral |
compUnaryMinus(AbleRd theRhs)
Compute, the unary minus of the current value of this object. |
boolean |
getBooleanValue()
Retrieve the value of this data object as a boolean value. |
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. |
java.lang.String |
getDataTypeName()
Retrieve the data type name. |
double |
getDiscourseHi()
Retrieve the variable's maximum allowed value.. |
double |
getDiscourseLo()
Retrieve the variable's minimum allowed value. |
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. |
java.lang.Class |
getLiteralClass()
Retrieve the class of this variable's related AbleLiteral data type. |
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 |
getValueString()
Retrieve the variable's current value as a string. |
void |
init()
Init the variable to its initial state. |
void |
reset()
Reset the variable to its intial state. |
void |
setBooleanValue(boolean theNewValue)
Set the value of this data object from a boolean value. |
void |
setDiscourseHi(double theValue)
Set the variable's maximum allowed value. |
void |
setDiscourseLo(double theValue)
Set the variable's minimum allowed value. |
void |
setFuzzyValue(AbleFuzzySet 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 |
setInitialValue(AbleRd theInitialValue)
Set the initial value (literal or expression) for this variable |
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 |
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 |
traceString(int theTraceStringFlavor)
Retrieve a string describing (the contents of) the object. |
boolean |
withinUniverseOfDiscourse(double theValue)
Determine whether a particular value is within the universe of discourse (between the low and high values inclusive) for this variable. |
java.lang.String |
xmlDclString()
Return a formal XML "declaration" string that describes this data object. |
Methods inherited from class com.ibm.able.data.AbleVariable |
---|
arlCRdString, arlInitializerString, getArlComment, getChgSupport, getComment, getContext, getDataType, getDataTypeAsString, getId, getName, getPrompt, getPromptString, getReferences, getReferent, getReferents, getTemplateString, isBound, isConstant, isGlobal, isLocal, isStatic, isTemplate, notStatic, setChgSupport, setComment, setContext, setId, setPrompt, setReferences, setStatic, setTemplate, xmlCRdString, xmlCWrString, xmlInitializerString |
Methods inherited from class com.ibm.able.data.AbleLhs |
---|
asgnIs, asgnIs, bitwiseAND, bitwiseNOT, bitwiseOR, bitwiseShiftLeft, bitwiseShiftRight, bitwiseShiftRightZeroFill, bitwiseXOR, cmpIs, compModulo, Copyright, logicalAND, logicalNOT, logicalOR |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
protected double myDiscourseLo
protected double myDiscourseHi
protected double myValue
Initialized to Double.NaN.
protected double myInitialValue
Constructor Detail |
public AbleContinuousVariable(double theDiscourseLo, double theDiscourseHi)
The initial value of this variable cannot be specified and is set to Double.NaN.
theDiscourseLo
- The lowest value that this variable may assume.
theDiscourseHi
- The highest value that this variable may assume.
public AbleContinuousVariable(double theDiscourseLo, double theDiscourseHi, double theInitialValue)
theDiscourseLo
- The lowest value that this variable may assume.
theDiscourseHi
- The highest value that this variable may assume.
theInitialValue
- The initial value for this variablepublic AbleContinuousVariable(java.lang.String theName, double theDiscourseLo, double theDiscourseHi)
The initial value of this variable cannot be specified and is set to Double.NaN.
theName
- The unique name of the variable.
theDiscourseLo
- The lowest value that this variable may assume.
theDiscourseHi
- The highest value that this variable may assume.
public AbleContinuousVariable(java.lang.String theName, boolean theStaticFlag, boolean theGlobalFlag, double theDiscourseLo, double theDiscourseHi)
The initial value of this variable cannot be specified and is set to Double.NaN.
theName
- The unique name of the variable.
theStaticFlag
- Use true if this variable is to be marked as
static, which means that it will ignore future reset
requests; use false if the variable can be
reset to its initial value when requested.
theGlobalFlag
- Use true if this variable is to be considered
global;
use false if the variable is to be considered
local.
theDiscourseLo
- The lowest value that this variable may assume.
theDiscourseHi
- The highest value that this variable may assume.
Method Detail |
public boolean getBooleanValue() throws AbleDataException
getBooleanValue
in class AbleLhs
AbleDataException
- If the value of this object cannot be represented as
a boolean value.public AbleFuzzySet getFuzzyValue() throws AbleDataException
getFuzzyValue
in class AbleLhs
AbleDataException
- If the value of this object cannot be represented as
a fuzzy value.public java.lang.Object getGenericValue() throws AbleDataException
getGenericValue
in class AbleLhs
AbleDataException
- If the value of this object cannot be represented as
an Object.public double getNumericValue() throws AbleDataException
getNumericValue
in class AbleLhs
AbleDataException
- If the value of this object cannot be represented as
a numeric value.public java.lang.String getStringValue() throws AbleDataException
getStringValue
in class AbleLhs
AbleDataException
- If the value of this object cannot be represented as
a string value.public AbleLiteral getValue() throws AbleDataException
getValue
in class AbleLhs
AbleDataException
- If the value of this object cannot be represented as
a literal.public void asgnEq(AbleRd theRhs) throws AbleDataException
asgnEq
in class AbleLhs
theRhs
- The right-hand, or source, side of the assignment.
AbleDataException
- If the right-hand side cannot be converted (if
necessary) and assigned to this data object.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.
cmpEq
in class AbleLhs
theRhs
- The right-hand side of the comparison.
AbleDataException
- If the right-hand side cannot be converted (if
necessary) and compared to this data object.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.
cmpGt
in class AbleLhs
theRhs
- The right-hand side of the comparison.
AbleDataException
- If the right-hand side cannot be converted (if
necessary) and compared to this data object.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.
cmpGtEq
in class AbleLhs
theRhs
- The right-hand side of the comparison.
AbleDataException
- If the right-hand side cannot be converted (if
necessary) and compared to this data object.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.
cmpLt
in class AbleLhs
theRhs
- The right-hand side of the comparison.
AbleDataException
- If the right-hand side cannot be converted (if
necessary) and compared to this data object.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.
cmpLtEq
in class AbleLhs
theRhs
- The right-hand side of the comparison.
AbleDataException
- If the right-hand side cannot be converted (if
necessary) and compared to this data object.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.
cmpNeq
in class AbleLhs
theRhs
- The right-hand side of the comparison.
AbleDataException
- If the right-hand side cannot be converted (if
necessary) and compared to this data object.public AbleLiteral compPlus(AbleRd theRhs) throws AbleDataException
"+" is used for numeric addtion and String concatenation.
compPlus
in class AbleLhs
theRhs
- The right-hand side of the comparison.
AbleDataException
- If the right-hand side cannot be converted (if
necessary) and compared to this data object.public AbleLiteral compMinus(AbleRd theRhs) throws AbleDataException
"-" is used for numeric subtraction.
compMinus
in class AbleLhs
theRhs
- The right-hand side of the comparison.
AbleDataException
- If the right-hand side cannot be converted (if
necessary) and compared to this data object.public AbleLiteral compMultiply(AbleRd theRhs) throws AbleDataException
"*" is used for numeric multiplication.
compMultiply
in class AbleLhs
theRhs
- The right-hand side of the comparison.
AbleDataException
- If the right-hand side cannot be converted (if
necessary) and compared to this data object.public AbleLiteral compDivide(AbleRd theRhs) throws AbleDataException
"/" is used for numeric division.
compDivide
in class AbleLhs
theRhs
- The right-hand side of the comparison.
AbleDataException
- If the right-hand side cannot be converted (if
necessary) and compared to this data object.public AbleLiteral compUnaryMinus(AbleRd theRhs) throws AbleDataException
"-" is used for numeric negation.
compUnaryMinus
in class AbleLhs
theRhs
- The right-hand side of the operation (ignored).
AbleDataException
- If the value of this data object cannot be negated.public void setBooleanValue(boolean theNewValue) throws AbleDataException
setBooleanValue
in class AbleLhs
theNewValue
- A boolean value.
If the new value is true the variable is set to
1.0, but only if that value is within the universe of discourse;
if the new value is false the variable is set to
0.0, but only if that value is within the universe of discourse.
AbleDataException
- If the value of this object cannot be represented as
a boolean value.public void setFuzzyValue(AbleFuzzySet theNewValue) throws AbleDataException
setFuzzyValue
in class AbleLhs
theNewValue
- A fuzzy set.
AbleDataException
- If the value of this object cannot be represented as
a fuzzy value.public void setGenericValue(java.lang.Object theNewValue) throws AbleDataException
setGenericValue
in class AbleLhs
theNewValue
- Any type of Object.
AbleDataException
- If the value of this object cannot be derived from
the specified Object.public void setNumericValue(double theNewValue) throws AbleDataException
setNumericValue
in class AbleLhs
theNewValue
- Any number. If the number is not within the universe
of discourse for this variable, an exception is
thrown.
AbleDataException
- If the value of this object cannot be represented as
a numeric value.public void setStringValue(java.lang.String theNewValue) throws AbleDataException
setStringValue
in class AbleLhs
theNewValue
- A string.
The variable is set to the value of the string, but
only if the string can be parsed to a double and that
number is within the universe of discourse for this
variable.
Otherwise an exception is thrown.
AbleDataException
- If the value of this object cannot be represented as
a string value.public void setValue(AbleLiteral theNewValue) throws AbleDataException
setValue
in class AbleLhs
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. The resulting
number must be within the universe of discourse for
this variable.
AbleDataException
- If the value of this object cannot be determined
from the literal object.public java.lang.String arlDclString()
arlDclString
in class AbleVariable
public java.lang.String xmlDclString()
xmlDclString
in class AbleVariable
public void setValueString(java.lang.String theNewValue) throws AbleDataException
setValueString
in class AbleVariable
public java.lang.String getValueString()
getValueString
in class AbleVariable
public void reset() throws AbleDataException
reset
in class AbleVariable
public void init() throws AbleDataException
init
in class AbleVariable
public java.lang.Class getDataTypeClass()
AbleLhs
getDataTypeClass
in class AbleLhs
com.ibm.able.data.AbleLhs
public java.lang.String getDataTypeClassName()
AbleLhs
getDataTypeClassName
in class AbleLhs
com.ibm.able.data.AbleLhs
public java.lang.String getDataTypeName()
getDataTypeName
in class AbleVariable
public java.lang.Class getLiteralClass()
getLiteralClass
in class AbleVariable
public void setDiscourseLo(double theValue)
theValue
- The new minimum value that the variable may assume.
public double getDiscourseLo()
public void setDiscourseHi(double theValue)
theValue
- The new maximum value that the variable may assume.
public double getDiscourseHi()
public boolean withinUniverseOfDiscourse(double theValue)
theValue
- A number to be tested.
public void setInitialValue(AbleRd theInitialValue) throws AbleDataException
setInitialValue
in class AbleVariable
theInitialValue
- An AbleLiteral or AbleExpression used to set the initial valueprotected boolean chkRange(double theNumber)
public java.lang.String toString()
toString
in class AbleVariable
public java.lang.String traceString(int theTraceStringFlavor)
traceString
in class AbleVariable
theFlavor
- An Able.TraceStringFlavor value.
|
ABLE 2.0.0 07/02/2003 10:25:01 | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |