Overview | Package | Class | Use | Tree | Serialized | Deprecated | Index | Help
| 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

## com.ibm.able.rules
Class AblePatternMatchRule

    java.lang.Object
      com.ibm.able.rules.AbleRule
          com.ibm.able.rules.AblePatternMatchRule

All Implemented Interfaces:
  java.io.Serializable

public class AblePatternMatchRule
extends AbleRule
implements java.io.Serializable

This class defines a pattern match rule which consists of a set of AbleSelectors (logically ANDed together) and one or more consequent action clauses.

See Also:
  `AblePatternMatchEngine`, `AblePatternMatchLiteEngine`, Serialized Form

Field Summary
`protected boolean` | `checkForPatternMatchEngine` If used with the Rete' net, keep the pointer to the patternMatch engine.
`protected java.util.HashSet` | `myBindings` myBindings is a vector of vectors.
`protected java.util.Vector` | `myConsequents` myConsequents is a list of consequent clauses (AbleConsequentClause objects).
`protected java.util.Vector` | `myNetworkSelectors` myNetworkSelectors is a list of AbleSelectors objects used by the AblePatternMatchEngine (Rete' network).
`protected AblePatternMatchClause` | `myPatternMatchClause` myPatternMatchClause is an object made from the list of AbleSelector objects.
`protected AblePatternMatchEngine` | `myPatternMatchEngine`
`protected int` | `myRuleNumber`
`protected java.util.Vector` | `mySelectors` mySelectors is a list of AbleSelectors objects.
`protected com.ibm.able.rules.AblePatternMatchRuleTerminalNode` | `myTerminalNode` If used with the Rete' net, point to terminal node
`protected static int` | `RuleNumber` Number the rules to preserve creation order when firing

Fields inherited from class com.ibm.able.rules.AbleRule
`myBooleanTruth, myBreakpoint, myComment, myEnabled, myFinalFlag, myFiredCount, myFiredFlag, myId, myLabel, myLocation, myPreConditions, myPriority, myPrompt, myProperties, myRdRefs, myRuleBlock, myRuleSet, myTemplateFlag, myTemplateName, myTemplateValues, myWrRefs, PriorityDefault, RuleIdInitial`

Constructor Summary
`AblePatternMatchRule(java.lang.String theLabel, AbleRd thePriority, java.util.Vector theSelectors, java.util.Vector theConsequents, AbleRuleSet theRuleSet, AbleRuleBlock theRuleBlock)` Create a new pattern match rule with the specified priority, selectors, and consequent clauses.

Method Summary
`protected boolean` | `addToConflictSet()`
`java.lang.String` | `arlString()` Return a formal Able Rule Language (ARL) String.
`java.lang.String` | `armlString()` Return a formal XML string.
`void` | `createNetworkSelectors(AbleRuleSet theRuleSet)` Create a duplicate set of Selectors, with duplicate expressions as constraints and using duplicate selector variables.
`void` | `createNetworkSelectors2(AbleRuleSet theRuleSet)` Create a duplicate set of Selectors, with clauses rather than expressions as constraints and using duplicate selector variables.
`java.util.Collection` | `getBindings()` Retrieve the rule's variable bindings, if any.
`java.util.Vector` | `getDoActions()` Retrieve the rule's list of "do" action clauses.
`java.util.Vector` | `getNetworkSelectors()` Retrieve the set of network selectors.
`java.util.Vector` | `getNetworkSelectorVariables()` Retrieve the set of network selector variables.
`AblePatternMatchClause` | `getPatternMatchClause()` Retrieve the rule's pattern match clause.
`java.util.Vector` | `getRuleBindings()` Retrieves the rule's variable bindings, if any, and removes them from the rules binding list.
`java.util.Vector` | `getSelectors()` Retrieve the rule's list of selector clauses.
`java.util.Vector` | `getSelectorVariables()` Return a list of selector variables used in this rule
`java.lang.String` | `getTemplateString(java.util.Vector theTemplateVars)` Retrieve a text format string for use by rule templates.
`boolean` | `isTriggered()` Returns true if the rule bindings is not an empty set
`long` | `numberOfSelectors()` Retrieve the number of selector clauses in this rule.
`void` | `removeBindings(java.util.Vector theBindings)` A set of bindings was used to fire a rule Remove it from the activationList
`protected boolean` | `removeFromConflictSet()`
`void` | `reset()` Reset the rule to its unfired state.
`void` | `setBindings(java.util.Collection theBindings)`
`void` | `setBindings(java.util.HashSet theBindings)` Set the rule's variable bindings, if any.
`void` | `setTerminalNode(com.ibm.able.rules.AblePatternMatchRuleTerminalNode theNode)`
`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, arlActionBlockString, arlPreConditionsString, armlPreConditionsString, armlPriorityString, armlPropertiesString, checkTimePeriodPreConditions, clearBreakpoint, getArlComment, getBooleanTruth, getBreakpoint, getComment, getId, getIdLabelString, getLabel, getLocation, getMetaData, getPreConditions, getPriority, getPrompt, getPromptString, getProperties, getProperty, getRdReferences, getTemplateActionBlockString, getTemplateHeaderString, getTemplateName, getTemplateValues, getTemplateVars, getWrReferences, isDefaultPriority, isEnabled, isFinal, isFired, isGeneratedFromTemplate, isTemplate, logTrace, removeProperty, setBooleanTruth, setBreakpoint, setComment, setEnabled, setFinal, setFired, setId, setLocation, setMetaData, setPreConditions, setPriority, setPrompt, setProperties, setProperty, setTemplate, setTemplateName, setTemplateValues, xmlPreConditionsString, xmlPriorityString`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Field Detail

### mySelectors

    protected java.util.Vector mySelectors

  mySelectors is a list of AbleSelectors objects.

### myNetworkSelectors

    protected java.util.Vector myNetworkSelectors

  myNetworkSelectors is a list of AbleSelectors objects used by the AblePatternMatchEngine (Rete' network). These are created using the createNetworkSelectors() method.

### myPatternMatchClause

    protected AblePatternMatchClause myPatternMatchClause

  myPatternMatchClause is an object made from the list of AbleSelector objects. It is used for efficiency during inferencing.

### myBindings

    protected java.util.HashSet myBindings

  myBindings is a vector of vectors. Each Vector contains a set of references to objects in the working memory that can be bound to the selector variables defined in the selectors. If myBindings.size() > 0 then isTriggered() is true (the rule could fire).

### myConsequents

    protected java.util.Vector myConsequents

  myConsequents is a list of consequent clauses (AbleConsequentClause objects).

### myTerminalNode

    protected com.ibm.able.rules.AblePatternMatchRuleTerminalNode myTerminalNode

  If used with the Rete' net, point to terminal node

### checkForPatternMatchEngine

    protected boolean checkForPatternMatchEngine

  If used with the Rete' net, keep the pointer to the patternMatch engine.

### myPatternMatchEngine

    protected AblePatternMatchEngine myPatternMatchEngine

### RuleNumber

    protected static int RuleNumber

  Number the rules to preserve creation order when firing

### myRuleNumber

    protected int myRuleNumber

Constructor Detail

### AblePatternMatchRule

    public AblePatternMatchRule(java.lang.String theLabel,
                                AbleRd thePriority,
                                java.util.Vector theSelectors,
                                java.util.Vector theConsequents,
                                AbleRuleSet theRuleSet,
                                AbleRuleBlock theRuleBlock)

  Create a new pattern match rule with the specified priority, selectors, and consequent clauses.

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

  `thePriority` - The priority of this rule.

  `theSelectors` - A list of AbleSelector objects that define the selectors (variables and constraints) of this rule. The list is cloned.

  `theConsequents` - A list of AbleConsequentClause objects that define the consequents or actions of this rule.

Method Detail

### createNetworkSelectors

    public void createNetworkSelectors(AbleRuleSet theRuleSet)
                                throws AbleParException

  Create a duplicate set of Selectors, with duplicate expressions as constraints and using duplicate selector variables. These are used in the Rete' network to avoid problems when firing pattern match rules.

  Throws:
    `AbleParException`

### createNetworkSelectors2

    public void createNetworkSelectors2(AbleRuleSet theRuleSet)
                                 throws AbleParException

  Create a duplicate set of Selectors, with clauses rather than expressions as constraints and using duplicate selector variables. These are used in the Rete' network to avoid problems when firing pattern match rules.

  Throws:
    `AbleParException`

### getNetworkSelectors

    public java.util.Vector getNetworkSelectors()

  Retrieve the set of network selectors. Note createNetworkSelectors() must be called first.

### getNetworkSelectorVariables

    public java.util.Vector getNetworkSelectorVariables()

  Retrieve the set of network selector variables. Note: createNetworkSelectors() must be called first.

### getSelectors

    public final java.util.Vector getSelectors()

  Retrieve the rule's list of selector clauses.

  Returns:
    A reference to the actual list of selector clauses. This list may not be empty.

### getDoActions

    public final java.util.Vector getDoActions()

  Retrieve the rule's list of "do" action clauses.

  Returns:
    A reference to the actual list of do action clauses. This list may not be empty.

### numberOfSelectors

    public long numberOfSelectors()

  Retrieve the number of selector clauses in this rule.

  Returns:
    A reference to the actual list of selector 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.

### getPatternMatchClause

    public final AblePatternMatchClause getPatternMatchClause()

  Retrieve the rule's pattern match clause.

  Returns:
    The pattern match clause, comprised of the AbleSelectors used to match data items.

### getBindings

    public final java.util.Collection getBindings()

  Retrieve the rule's variable bindings, if any.

  Returns:
    The Vector of vectors of variable bindings.

### getRuleBindings

    public final java.util.Vector getRuleBindings()

  Retrieves the rule's variable bindings, if any, and removes them from the rules binding list.

  Returns:
    The Vector of objects to be bound to variables when firing this rule.

### setBindings

    public void setBindings(java.util.HashSet theBindings)

  Set the rule's variable bindings, if any.

  Parameters:
    `theBindings` - The Vector containing sets of valid variable bindings
  Returns:
    The Vector of vectors of variable bindings. or Vector of tokens containing variable bindings

### setBindings

    public void setBindings(java.util.Collection theBindings)

### removeFromConflictSet

    protected boolean removeFromConflictSet()

### addToConflictSet

    protected boolean addToConflictSet()

### removeBindings

    public void removeBindings(java.util.Vector theBindings)

  A set of bindings was used to fire a rule Remove it from the activationList

### setTerminalNode

    public void setTerminalNode(com.ibm.able.rules.AblePatternMatchRuleTerminalNode theNode)

### getSelectorVariables

    public java.util.Vector getSelectorVariables()

  Return a list of selector variables used in this rule

### isTriggered

    public boolean isTriggered()

  Returns true if the rule bindings is not an empty set

### reset

    public void reset()

  Reset the rule to its unfired state.

  Overrides:
    `reset` in class `AbleRule`

### arlString

    public java.lang.String arlString()

  Return a formal Able Rule Language (ARL) String.

  Specified by:
    `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.

  Specified by:
    `xmlString` in class `AbleRule`
  Returns:
    A String describing the object in XML.

### armlString

    public java.lang.String armlString()

  Return a formal XML string.

  Specified by:
    `armlString` in class `AbleRule`
  Returns:
    A String describing the object in XML.

### 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.

  Specified by:
    `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.
  Throws:
    `AbleDataException`
  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.

  Specified by:
    `traceString` in class `AbleRule`
  Parameters:
    `theTraceStringFlavor` - An Able.TraceStringFlavor value.

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

Overview | Package | Class | Use | Tree | Serialized | Deprecated | Index | Help
| 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

(C) Copyright IBM Corporation 1999, 2005