|
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.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 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.BitSet |
myRdRefs
myRdRefs is a list of variables referenced by all the clauses in this rule. |
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. |
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. |
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 |
static java.lang.String |
Copyright()
Determine the copyright of this class. |
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 |
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.BitSet |
getRdReferences()
Retrieve the list of variable Ids that are referenced by this rule's clauses. |
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 |
isEnabled()
Retrieve the rule's enabled state |
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)
|
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 |
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 |
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 |
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 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 java.lang.Object[] myTemplateValues
protected AbleLocation myLocation
protected AbleRuleBreakpoint myBreakpoint
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.
myComment
public java.lang.String getComment()
myComment
public java.lang.String getArlComment()
myComment
protected 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
public void setEnabled(boolean theState)
theState
- The boolean enabled state of the rulepublic boolean isEnabled()
public void setPreConditions(java.lang.Object[] thePreConditions) throws AbleDataException
public final void checkTimePeriodPreConditions(java.util.Calendar theCurrentTime) throws AbleDataException
public void setTemplate(boolean theTemplateFlag)
public boolean isTemplate()
public abstract java.lang.String arlString()
protected java.lang.String arlPreConditionsString()
public abstract java.lang.String xmlString()
public java.lang.String xmlPriorityString()
protected java.lang.String xmlPreConditionsString()
public abstract java.lang.String traceString(int theTraceStringFlavor)
theFlavor
- An AbleRuleSet.TraceStringFlavor value.
protected void logTrace(java.lang.String theLogEntry)
public abstract java.lang.String getTemplateString(java.util.Vector theTemplateVars) throws AbleDataException
AbleRuleTemplate
public java.lang.String getTemplateHeaderString(java.util.Vector theTemplateVars) throws AbleDataException
theTemplateVars
- An ordered list of template variables referenced by this rule.AbleRuleTemplate
public java.util.Vector getTemplateVars(AbleRuleSet theRuleSet) throws AbleDataException
public 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.
myPrompt
public java.lang.String getPrompt()
myPrompt
public 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.
myPrompt
public void setLocation(AbleLocation theLocation)
public AbleLocation getLocation()
public void setBreakpoint(AbleRuleBreakpoint theBreakpoint)
public AbleRuleBreakpoint getBreakpoint()
public void clearBreakpoint()
public java.lang.String toString()
toString
in class java.lang.Object
public static java.lang.String Copyright()
|
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 |