|
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
This class defines the base ABLE data variable object. AbleVariables are used to hold mutable values corresponding to the Java primitive types and to certain other Object types (Object, String, Calendar, etc.). AbleVariables can appear on the left-hand side of assignment statements (as contrasted with AbleLiterals which are treated as constants).
AbleVariables support the "static" modifier, which means that the variable will not be reset to its initial value before each inferencing cycle (when used as part of an AbleRuleSet).
AbleVariables support the "template" modifier, which means that the variable can be used in rule templates as placeholders for customized values.
Variables can be global or local. Global variables are defined in the variables { } section of an AbleRuleSet and can be accessed by all rules in the ruleset. Local variables are limited to a visibility by a single rule.
Initial values are set on the constructor or using the setInitialValue() method. A reset() will set the variable value back to the initial value.
Field Summary | |
---|---|
protected boolean |
myBoundFlag
A flag that indicates if this variable's value has been set by an initializer or by an assignment. |
protected java.beans.PropertyChangeSupport |
myChgSupport
A set of listeners interested in property changes performed by this variable. |
protected java.lang.String |
myComment
"myComment" provides a place to associate a comment with 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 boolean |
myGlobalFlag
A flag that indicates whether this variable is "global" (true) or "local" (false). |
protected int |
myId
The unique Id of this particular variable. |
protected java.lang.String |
myName
The unique name of this particular variable. |
protected java.lang.String |
myPrompt
"myPrompt" provides a place to associate a user prompt with this variable. |
protected AbleReferences |
myReferences
A set of references to this variable. |
protected boolean |
myStaticFlag
A flag that indicates whether this variable is "static". |
protected boolean |
myTemplateFlag
A flag that indicates whether this variable is a template variable. |
protected AbleRd |
myValueInitial
The initial value (literal or expression) of the variable. |
Constructor Summary | |
---|---|
protected |
AbleVariable(int theDataType,
java.lang.String theName)
Create a new variable of the specified type and with the specified name. |
protected |
AbleVariable(int theDataType,
java.lang.String theName,
boolean theStaticFlag,
boolean theGlobalFlag)
Create a new variable of the specified type and with the specified name. |
Method Summary | |
---|---|
java.lang.String |
arlCRdString()
Return a formal ARL "clause read" string that describes this data object. |
abstract java.lang.String |
arlDclString()
Return a formal ARL "declaration" string that describes this data object. |
java.lang.String |
arlInitializerString()
|
java.lang.String |
getArlComment()
Retrieve the comment associated with this variable formatted as an arl string with javadoc delmiters around it. |
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.String |
getComment()
Retrieve the comment associated with this variable. |
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. |
abstract java.lang.String |
getDataTypeName()
Retrieve the data type name. |
int |
getId()
Retrieve the unique Id of this variable. |
abstract java.lang.Class |
getLiteralClass()
Retrieve the class of this variable's related AbleLiteral data type. |
java.lang.String |
getName()
Retrieve the unique name of this variable. |
java.lang.String |
getPrompt()
Retrieve the user prompt associated with this variable. |
java.lang.String |
getPromptString()
Retrieve the user prompt string associated with 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. |
java.util.BitSet |
getReferents()
Retrieve the Ids of the variables to which this data object refers, if any. |
java.lang.String |
getTemplateString(java.util.Vector theTemplateVars)
Return a formatted ARL text string for use by templates |
abstract java.lang.String |
getValueString()
Retrieve the variable's current value as a string. |
abstract void |
init()
Init the variable to its default or initial state. |
boolean |
isBound()
Retrieves the boolean flag that indicates whether this variable's value has been set by an initializer or assignment |
boolean |
isConstant()
Returns true if this AbleRd object is a constant value false, if it does not. |
boolean |
isGlobal()
Determine whether this variable is global. |
boolean |
isLocal()
Determine whether this variable is local. |
boolean |
isStatic()
Determine whether this variable is static; that is, whether it will ignore reset requests. |
boolean |
isTemplate()
Returns true if this variable is a template variable, false otherwise. |
boolean |
notStatic()
Determine whether this variable is not static; that is, whether it will honor reset requests. |
abstract void |
reset()
Reset the variable to its initial state subject to static flag (if static is true then variable is not reset). |
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 |
setComment(java.lang.String theComment)
Set (or change) the comment associated with this variable. |
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 |
setInitialValue(AbleRd theInitialValue)
Set the initial value (literal or expression) for this variable |
void |
setPrompt(java.lang.String thePrompt)
Set (or change) the user prompt associated with this variable. |
void |
setReferences(AbleReferences theReferences)
Set the set of objects that refer to this variable. |
void |
setStatic(boolean theStaticFlag)
Set this variable as static or not static. |
void |
setTemplate(boolean theTemplateFlag)
Set the state of the template flag for 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. |
abstract 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. |
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. |
java.lang.String |
xmlInitializerString()
|
Methods inherited from class com.ibm.able.data.AbleLhs |
---|
asgnEq, asgnIs, asgnIs, bitwiseAND, bitwiseNOT, bitwiseOR, bitwiseShiftLeft, bitwiseShiftRight, bitwiseShiftRightZeroFill, bitwiseXOR, cmpEq, cmpGt, cmpGtEq, cmpIs, cmpLt, cmpLtEq, cmpNeq, compDivide, compMinus, compModulo, compMultiply, compPlus, compUnaryMinus, Copyright, getBooleanValue, getDataTypeClass, getDataTypeClassName, getFuzzyValue, getGenericValue, getNumericValue, getStringValue, getValue, logicalAND, logicalNOT, logicalOR, 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 |
protected int myDataType
This field is initialized to AbleData.DataTypeUnknown.
protected int myId
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 AbleData.VarIdNull.
protected java.lang.String myName
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 ("").
protected java.lang.Object myContext
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.
protected AbleReferences myReferences
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.
protected java.beans.PropertyChangeSupport myChgSupport
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.
protected boolean myStaticFlag
Static variables ignore all calls to reset; that is, their current value is always the value that was last explicitly set.
This field is initialized to false.
protected boolean myGlobalFlag
This field is initialized to true and may be reset when a local variable is constructed.
protected AbleRd myValueInitial
protected java.lang.String myComment
setComment(String)
,
getComment()
protected java.lang.String myPrompt
setPrompt(String)
,
getPrompt()
protected boolean myTemplateFlag
protected boolean myBoundFlag
Constructor Detail |
protected AbleVariable(int theDataType, java.lang.String theName)
theDataType
- An AbleData.<DataType> constant.
theName
- The unique name of the variable.
protected AbleVariable(int theDataType, java.lang.String theName, boolean theStaticFlag, boolean theGlobalFlag)
theDataType
- An AbleData.<DataType> constant.
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 marked as
global;
use false if the variable is considered
local.
Method Detail |
public int getReferent()
getReferent
in class AbleLhs
public java.util.BitSet getReferents()
public int getDataType()
getDataType
in class AbleLhs
public java.lang.String arlCRdString()
arlCRdString
in class AbleLhs
public java.lang.String xmlCRdString()
xmlCRdString
in class AbleLhs
public abstract java.lang.String traceString(int theTraceStringFlavor)
traceString
in class AbleLhs
theFlavor
- An AbleRuleSet.TraceStringFlavor value.
public abstract java.lang.String arlDclString()
arlDclString
in class AbleLhs
public java.lang.String getTemplateString(java.util.Vector theTemplateVars)
public abstract java.lang.String xmlDclString()
xmlDclString
in class AbleLhs
public java.lang.String xmlCWrString()
xmlCWrString
in class AbleLhs
public java.lang.String xmlInitializerString()
public java.lang.String arlInitializerString()
public abstract void setValueString(java.lang.String theNewValue) throws AbleDataException
public abstract java.lang.String getValueString()
public abstract void init() throws AbleDataException
public abstract void reset() throws AbleDataException
public abstract java.lang.Class getLiteralClass()
public java.lang.String getDataTypeAsString()
public abstract java.lang.String getDataTypeName()
public void setId(int theId)
theId
- An integer, which is the unique Id of this variable.
public int getId()
public java.lang.String getName()
public void setContext(java.lang.Object theContext)
theContext
- A reference to an Object, or null.
public java.lang.Object getContext()
public void setComment(java.lang.String theComment)
theComment
- A String containing the new comment for this variable.
This comment replaces the current comment.
myComment
public java.lang.String getComment()
myComment
public java.lang.String getArlComment()
myComment
public void setPrompt(java.lang.String thePrompt)
thePrompt
- A String containing the user prompt for this variable.
This comment replaces the current prompt.
myPrompt
public java.lang.String getPrompt()
myPrompt
public java.lang.String getPromptString()
If there is no resource bundle then the prompt string is returned If there is a resource bundle but the myPrompt value is null then a message with the variable name as the key is returned. If there is a resource bundle with a non-null myPrompt value then a message with the myPrompt value as key is returned.
myPrompt
public void setChgSupport(java.beans.PropertyChangeSupport theChgSupport)
theChgSupport
- A reference to a PropertyChangeSupport object, or
null.
public java.lang.Object getChgSupport()
public void setReferences(AbleReferences theReferences)
theReferences
- A set of Objects that refer to this variable.
The set may be the empty set, or null.
public AbleReferences getReferences()
public void setStatic(boolean theStaticFlag)
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.
public boolean isStatic()
public boolean notStatic()
public boolean isGlobal()
public boolean isLocal()
public boolean isBound()
public boolean isConstant()
AbleRd
isConstant
in class AbleLhs
public void setInitialValue(AbleRd theInitialValue) throws AbleDataException
theInitialValue
- An AbleLiteral or AbleExpression used to set the initial valuepublic void setTemplate(boolean theTemplateFlag)
public boolean isTemplate()
public java.lang.String toString()
toString
in class java.lang.Object
|
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 |