|
ABLE 2.3.0 07/13/2005 14:21:00 | |||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||||
java.lang.Objectcom.ibm.able.rules.AbleRule
This class defines an abstract rule from which derived rules can inherit an ID, label, priority, and other parts. How these parts are used is entirely up to inference engines that work on the rules. For example, some inference engines may make use of the priority field while others may not. To a rule itself, priority is nothing more than a field to be set and returned. The same is true of all base rule members.
| Field Summary | |
|---|---|
protected java.lang.Boolean |
myBooleanTruth
myBooleanTruth contains the current truth value of this rule, but only if the rule has been evaluated. |
protected AbleRuleBreakpoint |
myBreakpoint
An optional breakpoint assoicated with this rule. |
protected java.lang.String |
myComment
"myComment" provides a place to associate a comment with this rule. |
protected boolean |
myEnabled
myEnabled indicates whether the rule is enabled for use or not. |
protected boolean |
myFinalFlag
A flag that indicates whether this rule is a 'final' rule. |
protected int |
myFiredCount
myFiredCount indicates how many times this rule has been 'fired', since it was initialized. |
protected boolean |
myFiredFlag
myFiredFlag indicates whether the rule has been 'fired', or evaluated. |
protected int |
myId
myId is the unique Id of this particular rule. |
protected java.lang.String |
myLabel
myLabel is the unique name of this particular rule. |
protected AbleLocation |
myLocation
The location of this rule in the source ARL file. |
protected java.lang.Object[] |
myPreConditions
myPreConditions (if defined) is a list of objects defined in the rule header. |
protected AbleRd |
myPriority
myPriority indicates the priority of this rule relative to other rules. |
protected java.lang.String |
myPrompt
"myPrompt" provides a place to associate a user prompt with this rule. |
protected java.util.Map |
myProperties
A collection of properties that the user can set and use in any manner desired. |
protected java.util.BitSet |
myRdRefs
myRdRefs is a list of variables referenced by all the clauses in this rule. |
protected AbleRuleBlock |
myRuleBlock
myRuleSet is a reference to the owning ruleset. |
protected AbleRuleSet |
myRuleSet
myRuleSet is a reference to the owning ruleset. |
protected boolean |
myTemplateFlag
A flag that indicates whether this rule is a template rule. |
protected java.lang.String |
myTemplateName
The name of the template rule from which this rule was generated (if any). |
protected java.lang.Object[] |
myTemplateValues
The list of String replacement values used to generate this rule from the template (if any). |
protected java.util.BitSet |
myWrRefs
myWrRefs is a list of variables set by the consequent clauses in this rule. |
static AbleRd |
PriorityDefault
A default priority for rules. |
static int |
RuleIdInitial
The ID of the first created rule. |
| Constructor Summary | |
|---|---|
AbleRule(int theId,
java.lang.String theLabel,
AbleRd thePriority,
AbleRuleSet theRuleSet)
Create a new rule with the specified bits. |
|
| Method Summary | |
|---|---|
java.util.BitSet |
addHeaderRdReferences()
Add rule header variable references including priority and rule preConditions. |
protected void |
addRdReference(int theId)
Update the list of variables whose values are "read" by clauses in this rule. |
protected void |
addRdReferences(java.util.BitSet theIds)
Update the list of variables whose values are "read" by clauses in this rule. |
protected void |
addWrReference(int theId)
Update the list of variables whose values are "set" by clauses in this rule. |
protected void |
addWrReferences(java.util.BitSet theIds)
Update the list of variables whose values are "set" by clauses in this rule. |
static java.lang.String |
arlActionBlockString(java.lang.String thePreFix,
java.util.Vector theActions)
Return a formal Able Rule Language (ARL) String for a set of actions in a rule. |
protected java.lang.String |
arlPreConditionsString()
Return a formal Able Rule Language (ARL) String for the rule preConditions. |
abstract java.lang.String |
arlString()
Return a formal Able Rule Language (ARL) String. |
protected java.lang.String |
armlPreConditionsString()
Return a formal XML string for the rule preConditions. |
java.lang.String |
armlPriorityString()
Return a formal XML string for the rule priority. |
java.lang.String |
armlPropertiesString()
Return a formal XML string for the rule priority. |
abstract java.lang.String |
armlString()
Return a formal XML string. |
void |
checkTimePeriodPreConditions(java.util.Calendar theCurrentTime)
Evaluate each rule in the ruleblock against the time period preconditions. |
void |
clearBreakpoint()
Remove the breakpoint from this rule |
java.lang.String |
getArlComment()
Retrieve the comment associated with this rule as an arl string with javadoc delimiters around it. |
java.lang.Boolean |
getBooleanTruth()
Retrieve the rule's overall truth value. |
AbleRuleBreakpoint |
getBreakpoint()
Returns the breakpong associated with this rule (or null if none is defined). |
java.lang.String |
getComment()
Retrieve the comment associated with this rule. |
int |
getId()
Retrieve the rule's unique Id. |
java.lang.String |
getIdLabelString()
Retrieve the rule's unique Id and label in a single string. |
java.lang.String |
getLabel()
Retrieve the rule's unique label. |
AbleLocation |
getLocation()
Returns the location of the rule in the source ARL file |
java.lang.Object[] |
getMetaData()
Retrieve the metaData (preConditions) on this rule |
java.lang.Object[] |
getPreConditions()
Retrieve the preConditions on this rule |
double |
getPriority()
Retrieve the rule's priority. |
java.lang.String |
getPrompt()
Retrieve the user prompt associated with this rule. |
java.lang.String |
getPromptString(AbleRuleSet theRuleSet)
Retrieve the user prompt string associated with this rule. |
java.util.Map |
getProperties()
Returns a pointer to the entire current collection of properties. |
java.lang.String |
getProperty(java.lang.String theName)
Gets the property associated with the specified name. |
java.util.BitSet |
getRdReferences()
Retrieve the list of variable Ids that are referenced by this rule's clauses. |
static java.lang.String |
getTemplateActionBlockString(java.util.Vector theTemplateVars,
java.lang.String thePreFix,
java.util.Vector theActions)
Retrieve a text format string for a rule action block for use by rule templates. |
java.lang.String |
getTemplateHeaderString(java.util.Vector theTemplateVars)
Retrieve a text format string for the rule header info for use by rule templates. |
java.lang.String |
getTemplateName()
Retrieve the name of the template rule from which this rule was generated (if any) |
abstract java.lang.String |
getTemplateString(java.util.Vector theTemplateVars)
Retrieve a text format string for use by templates. |
java.lang.Object[] |
getTemplateValues()
Retrieve the String replacement values used to generate this rule from a template |
java.util.Vector |
getTemplateVars(AbleRuleSet theRuleSet)
Return a list of template vars referenced by this rule. |
java.util.BitSet |
getWrReferences()
Retrieve the list of variable Ids that are set by this rule's consequent clause. |
boolean |
isDefaultPriority()
|
boolean |
isEnabled()
Retrieve the rule's enabled state |
boolean |
isFinal()
Returns true if this rule is a 'final' rule, false otherwise. |
boolean |
isFired()
Determine whether the rule has fired. |
boolean |
isGeneratedFromTemplate()
Returns true if this rule was generated from a template rule |
boolean |
isTemplate()
Returns true if this rule is a template rule, false otherwise. |
protected void |
logTrace(java.lang.String theLogEntry)
|
java.lang.String |
removeProperty(java.lang.String theName)
Removes the property and the specified name from the collection of properties. |
void |
reset()
Reset the rule to its unfired state. |
void |
setBooleanTruth(java.lang.Boolean theTruthValue)
Set the rule's overall truth value. |
void |
setBreakpoint(AbleRuleBreakpoint theBreakpoint)
Set the breakpoint associated with this rule |
void |
setComment(java.lang.String theComment)
Set (or change) the comment associated with this rule. |
void |
setEnabled(boolean theState)
Set the rule's enabled state Note: this may be ignored by the inference engine |
void |
setFinal(boolean theFinalFlag)
Sets the state of the 'final' flag for this rule. |
void |
setFired(boolean theFiredFlag)
Set the flag that indicates whether the rule has fired. |
void |
setId(int theId)
Set the rule's unique Id. |
void |
setLocation(AbleLocation theLocation)
Set the location of the rule in the source ARL file |
void |
setMetaData(java.lang.Object[] theMetaData)
Set the metaData (preConditions) on this rule |
void |
setPreConditions(java.lang.Object[] thePreConditions)
Set the preConditions on this rule |
void |
setPriority(AbleRd thePriority)
Set the rule's priority. |
void |
setPrompt(java.lang.String thePrompt)
Set (or change) the user prompt associated with this rule. |
void |
setProperties(java.util.Map theProperties)
Sets the entire collection of properties to the specified collection. |
void |
setProperty(java.lang.String theName,
java.lang.String theValue)
Sets the specified property to the specified value. |
void |
setTemplate(boolean theTemplateFlag)
Set the state of the template flag for this rule. |
void |
setTemplateName(java.lang.String theTemplateName)
Set the name of the template rule from which this rule was generated |
void |
setTemplateValues(java.lang.Object[] theTemplateValues)
Set the String replacement values used to generate this rule from a template |
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. |
protected java.lang.String |
xmlPreConditionsString()
Return a formal XML string for the rule preConditions. |
java.lang.String |
xmlPriorityString()
Return a formal XML string for the rule priority. |
abstract java.lang.String |
xmlString()
Return a formal XML string. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
public static final AbleRd PriorityDefault
public static final int RuleIdInitial
protected int myId
Note that, in some situations, rules 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 rules are manipulated by an inference engine, the Id must exist and be guaranteed to be unique. Currently, it is up to the creator of any rule to set the Id appropriately.
protected java.lang.String myLabel
Note that in some situations, rules may not need any label at all so it may not matter whether the label is unique or even exists. However, in other situations, such as when rules are manipulated by an inference engine, the label must be guaranteed to be unique. Therefore, it is up to the creator of any rule to set the label appropriately.
It is strongly suggested that a label be provided for each and every rule, as the label will appear in various Able windows.
protected AbleRd myPriority
protected AbleRuleSet myRuleSet
protected AbleRuleBlock myRuleBlock
protected java.util.BitSet myRdRefs
protected java.util.BitSet myWrRefs
protected boolean myFiredFlag
protected int myFiredCount
protected java.lang.Boolean myBooleanTruth
protected boolean myEnabled
protected java.lang.Object[] myPreConditions
protected java.lang.String myComment
setComment(String),
getComment()protected java.lang.String myPrompt
setPrompt(String),
getPrompt()protected boolean myTemplateFlag
protected java.lang.String myTemplateName
protected boolean myFinalFlag
protected java.lang.Object[] myTemplateValues
protected AbleLocation myLocation
protected AbleRuleBreakpoint myBreakpoint
protected java.util.Map myProperties
The default underlying data type is java.util.Hashtable,
selected because its methods are synchronized. If
synchronization isn't an issue, use setProperties(Map)
to set the member to some other data type.
The member must never be null.
Property change events are not fired for changes to this member.
setProperty(String,String),
getProperty(String),
setProperties(Map),
getProperties()| Constructor Detail |
public AbleRule(int theId,
java.lang.String theLabel,
AbleRd thePriority,
AbleRuleSet theRuleSet)
theId - The unique Id of this rule.
theLabel - The unique label, or name, of this rule.
thePriority - The priority of this rule.
theRuleSet - A ruleset object to which this rule belongs.
| Method Detail |
public final void setId(int theId)
public final int getId()
public final java.lang.String getLabel()
public java.lang.String getIdLabelString()
public void setComment(java.lang.String theComment)
theComment - A String containing the new comment for this rule.
This comment replaces the current comment.
myCommentpublic java.lang.String getComment()
myCommentpublic java.lang.String getArlComment()
Any properties associated with this object are placed into the
comment using @prop tags.
myCommentprotected void addRdReference(int theId)
theId - The unique Id of a variable referenced in a clause of
this rule.
protected void addRdReferences(java.util.BitSet theIds)
theIds - The unique Ids of variables referenced in a clause of
this rule.
public java.util.BitSet getRdReferences()
protected void addWrReference(int theId)
theId - The unique Id of a variable whose value is set by the
consequent clause of this rule.
protected void addWrReferences(java.util.BitSet theIds)
theIds - The unique Ids of variables whose value is set by the
consequent clause of this rule.
public java.util.BitSet getWrReferences()
public java.util.BitSet addHeaderRdReferences()
public final void setFired(boolean theFiredFlag)
theFiredFlag - true if the rule has fired;
false otherwise.public final boolean isFired()
public void reset()
public final void setBooleanTruth(java.lang.Boolean theTruthValue)
This method is used by the forward chaining inference engine.
theTruthValue - true if all of the rule's antecedent clauses
evaluate to true;
false if any of the rule's antecedent clauses
evaluate to false;
null if the truth value is unknown or cannot be
determined.public final java.lang.Boolean getBooleanTruth()
This method is used by the forward chaining inference engine.
public final void setPriority(AbleRd thePriority)
thePriority - The priority of this rule.
public final double getPriority()
throws AbleDataException
AbleDataExceptionpublic void setEnabled(boolean theState)
theState - The boolean enabled state of the rulepublic boolean isEnabled()
public void setPreConditions(java.lang.Object[] thePreConditions)
throws AbleDataException
AbleDataException
public java.lang.Object[] getPreConditions()
throws AbleDataException
AbleDataException
public void setMetaData(java.lang.Object[] theMetaData)
throws AbleDataException
AbleDataException
public java.lang.Object[] getMetaData()
throws AbleDataException
AbleDataException
public final void checkTimePeriodPreConditions(java.util.Calendar theCurrentTime)
throws AbleDataException
AbleDataExceptionpublic void setTemplate(boolean theTemplateFlag)
public boolean isTemplate()
public void setFinal(boolean theFinalFlag)
public boolean isFinal()
public abstract java.lang.String arlString()
public static java.lang.String arlActionBlockString(java.lang.String thePreFix,
java.util.Vector theActions)
thePreFix - theActions -
protected java.lang.String arlPreConditionsString()
public abstract java.lang.String xmlString()
public abstract java.lang.String armlString()
public java.lang.String xmlPriorityString()
public java.lang.String armlPriorityString()
public java.lang.String armlPropertiesString()
protected java.lang.String xmlPreConditionsString()
protected java.lang.String armlPreConditionsString()
public abstract java.lang.String traceString(int theTraceStringFlavor)
theTraceStringFlavor - An AbleRuleSet.TraceStringFlavor value.
protected void logTrace(java.lang.String theLogEntry)
public abstract java.lang.String getTemplateString(java.util.Vector theTemplateVars)
throws AbleDataException
AbleDataExceptionAbleRuleTemplate
public java.lang.String getTemplateHeaderString(java.util.Vector theTemplateVars)
throws AbleDataException
theTemplateVars - An ordered list of template variables referenced by this rule.
AbleDataExceptionAbleRuleTemplate
public java.util.Vector getTemplateVars(AbleRuleSet theRuleSet)
throws AbleDataException
AbleDataException
public static java.lang.String getTemplateActionBlockString(java.util.Vector theTemplateVars,
java.lang.String thePreFix,
java.util.Vector theActions)
theTemplateVars - An ordered list of template variables referenced by this rule.
AbleRuleTemplatepublic boolean isGeneratedFromTemplate()
public void setTemplateName(java.lang.String theTemplateName)
public java.lang.String getTemplateName()
public void setTemplateValues(java.lang.Object[] theTemplateValues)
public java.lang.Object[] getTemplateValues()
public void setPrompt(java.lang.String thePrompt)
thePrompt - A String containing the user prompt for this rule.
This comment replaces the current prompt.
myPromptpublic java.lang.String getPrompt()
myPromptpublic java.lang.String getPromptString(AbleRuleSet theRuleSet)
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.
myPromptpublic void setLocation(AbleLocation theLocation)
public AbleLocation getLocation()
public void setBreakpoint(AbleRuleBreakpoint theBreakpoint)
public AbleRuleBreakpoint getBreakpoint()
public void clearBreakpoint()
public boolean isDefaultPriority()
public void setProperty(java.lang.String theName,
java.lang.String theValue)
theName - The name of the property to be placed into the
collection of properties.theValue - The value associated with the specified property.public java.lang.String getProperty(java.lang.String theName)
theName - The name of the property to be returned.
public java.lang.String removeProperty(java.lang.String theName)
theName - The name of the property to be removed.
public void setProperties(java.util.Map theProperties)
theProperties - The set of properties that will replace the current
collection of properties. If this parameter is
specified as null, the call is ignored; that
is, the underlying data member is not changed.
Otherwise, the underlying data member is changed to
point to the specified collection.
Keys and values of the properties collection must be confined to the String data type.
public java.util.Map getProperties()
public java.lang.String toString()
|
ABLE 2.3.0 07/13/2005 14:21:00 | |||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||||