ABLE 2.0.0 07/02/2003 10:25:01

com.ibm.able.rules
Class AbleConditionalRule

java.lang.Object
  |
  +--com.ibm.able.rules.AbleRule
        |
        +--com.ibm.able.rules.AbleConditionalRule
All Implemented Interfaces:
java.io.Serializable

public class AbleConditionalRule
extends AbleRule
implements java.io.Serializable

This class represents a conditional if-then rule, containing one or more boolean or fuzzy antecedent clauses (logically ANDed together) and one or more consequent clauses. Conditional rules are used by the Backward, Forward, and Fuzzy inference engines.

See Also:
AbleIfThenElseRule, Serialized Form

Field Summary
protected  java.util.Vector myAntecedents
          myAntecedents is a list of AbleAntecedentClause objects.
protected  java.util.Vector myAntExpressionList
          myAntExpressionList is a list of AbleExpression objects.
protected  java.util.Vector myThenList
          myThenList is a list of AbleConsequentClause objects.
 
Fields inherited from class com.ibm.able.rules.AbleRule
myBooleanTruth, myBreakpoint, myComment, myEnabled, myFiredCount, myFiredFlag, myId, myLabel, myLocation, myPreConditions, myPriority, myPrompt, myRdRefs, myRuleSet, myTemplateFlag, myTemplateName, myTemplateValues, myWrRefs, PriorityDefault, RuleIdInitial
 
Constructor Summary
AbleConditionalRule(java.lang.String theLabel, AbleRd thePriority, java.util.Vector theAntExprList, java.util.Vector theAntecedents, java.util.Vector theThenList)
          Create a new conditional rule with the specified priority, antecedent clauses, and consequent clause.
 
Method Summary
 java.lang.String arlString()
          Return a formal Able Rule Language (ARL) String.
 java.util.Vector getAntecedents()
          Retrieve the rule's list of antecedent clauses.
 java.lang.String getTemplateString(java.util.Vector theTemplateVars)
          Retrieve a text format string for use by rule templates.
 java.util.Vector getTemplateVars(AbleRuleSet theRuleSet)
          Return a list of template vars referenced by this rule.
 java.util.Vector getThenClauses()
          Retrieve the rule's list of consequent clauses.
 long numberOfAntecedents()
          Retrieve the number of antecedent clauses in this rule.
 long numberOfThenClauses()
          Retrieve the number of consequent clauses in this rule.
 void reset()
          Reset the rule to its unfired state.
 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.
 java.lang.String xmlString()
          Return a formal XML string.
 
Methods inherited from class com.ibm.able.rules.AbleRule
addHeaderRdReferences, addRdReference, addRdReferences, addWrReference, addWrReferences, arlPreConditionsString, checkTimePeriodPreConditions, clearBreakpoint, Copyright, getArlComment, getBooleanTruth, getBreakpoint, getComment, getId, getIdLabelString, getLabel, getLocation, getPriority, getPrompt, getPromptString, getRdReferences, getTemplateHeaderString, getTemplateName, getTemplateValues, getWrReferences, isEnabled, isFired, isGeneratedFromTemplate, isTemplate, logTrace, setBooleanTruth, setBreakpoint, setComment, setEnabled, setFired, setId, setLocation, setPreConditions, setPriority, setPrompt, setTemplate, setTemplateName, setTemplateValues, xmlPreConditionsString, xmlPriorityString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

myAntecedents

protected java.util.Vector myAntecedents
myAntecedents is a list of AbleAntecedentClause objects.

myAntExpressionList

protected java.util.Vector myAntExpressionList
myAntExpressionList is a list of AbleExpression objects.

myThenList

protected java.util.Vector myThenList
myThenList is a list of AbleConsequentClause objects. At least one must be present.
Constructor Detail

AbleConditionalRule

public AbleConditionalRule(java.lang.String theLabel,
                           AbleRd thePriority,
                           java.util.Vector theAntExprList,
                           java.util.Vector theAntecedents,
                           java.util.Vector theThenList)
Create a new conditional rule with the specified priority, antecedent clauses, and consequent clause.
Parameters:
theId - The unique Id of this rule.

theLabel - The unique label, or name, of this rule.

thePriority - The priority of this rule.

theAntExprList - A list of one or more AbleExpression objects that define the antecedents of this rule. The list is cloned.

theAntecedents - A list of AbleAntecedentClause objects that define the antecedents of this rule (derived from theAntExprList). The list is cloned.

theThenList - A list of assignment statements that define the consequents of this rule. The list must contain at least one AbleConsequentClause.

theElseList - A list of assignment statements that define the actions to perform when the antecedents fail. The list may be empty, but it must not be null.

theTracer - A tracer object to which this rule can log information. This may be null, in which case no information is logged.

Method Detail

getAntecedents

public final java.util.Vector getAntecedents()
Retrieve the rule's list of antecedent clauses.
Returns:
A reference to the actual list of antecedent clauses. This list may be empty (and will be empty if the rule is an assertion rather than a conditional rule), but the list is never null.

numberOfAntecedents

public long numberOfAntecedents()
Retrieve the number of antecedent clauses in this rule.
Returns:
The number of clauses.

getThenClauses

public final java.util.Vector getThenClauses()
Retrieve the rule's list of consequent clauses.
Returns:
The consequent clauses of the rule.

numberOfThenClauses

public long numberOfThenClauses()
Retrieve the number of consequent clauses in this rule.
Returns:
The number of clauses.

reset

public void reset()
Reset the rule to its unfired state. Clear all antecedent clause truthValues.
Overrides:
reset in class AbleRule

arlString

public java.lang.String arlString()
Return a formal Able Rule Language (ARL) String.
Overrides:
arlString in class AbleRule
Returns:
A String describing the object in Able rule language.

xmlString

public java.lang.String xmlString()
Return a formal XML string.
Overrides:
xmlString in class AbleRule
Returns:
A String describing the object in XML.

getTemplateVars

public java.util.Vector getTemplateVars(AbleRuleSet theRuleSet)
                                 throws AbleDataException
Return a list of template vars referenced by this rule. This overrides base AbleRule implementation to handle case where template vars are referenced in the then part of the rule
Overrides:
getTemplateVars in class AbleRule

getTemplateString

public java.lang.String getTemplateString(java.util.Vector theTemplateVars)
                                   throws AbleDataException
Retrieve a text format string for use by rule templates. The string contains "{n}" strings, where the index 'n' corresponds to the template variables defined in the rule template. This string is based on the standard arlString() representation of the rule. After replacement of the template variable values, the resulting string must be a valid ARL format string that can be parsed.
Overrides:
getTemplateString in class AbleRule
Parameters:
theTemplateVars - An ordered list of template variables referenced by this rule.
Returns:
A Text format string used to create a new rule instance.
See Also:
AbleRuleTemplate

toString

public java.lang.String toString()
Retrieve a string describing (the contents of) the object.
Overrides:
toString in class AbleRule
Returns:
A String containing the current contents of the object.

traceString

public java.lang.String traceString(int theTraceStringFlavor)
Retrieve a string describing (the contents of) the object.
Overrides:
traceString in class AbleRule
Parameters:
theFlavor - An Able.TraceStringFlavor value.

Returns:
A String containing the current contents of the object.

ABLE 2.0.0 07/02/2003 10:25:01

(C) Copyright IBM Corporation 1999, 2003