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

com.ibm.able.rules
Class AbleSelector

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

public class AbleSelector
extends java.lang.Object
implements java.io.Serializable

This class represents a single AbleVariable (the selected variable) and a set of constraints on the value that variable can take.

Selectors are created as part of when/do pattern match rules and directly via use of Selector data types in the Able Rule Language.

See Also:
Serialized Form

Field Summary
protected  AbleExpression constraintExpr
           
protected  java.util.Vector constraints
           
protected  AbleRuleSet myRuleSet
           
protected  boolean positive
           
protected  AbleVariable selectorVariable
           
 
Constructor Summary
AbleSelector()
          Create an AbleSelector object
AbleSelector(AbleRuleSet theRuleSet, AbleVariable selector, java.util.Vector constraints, boolean positive)
          Construct a selector object
AbleSelector(AbleVariable selector, AbleExpression constraintExpr, boolean positive)
          Construct a selector object
AbleSelector(AbleVariable selector, java.lang.Object constraintExpr, boolean positive)
          Construct a selector object
AbleSelector(AbleVariable selector, java.util.Vector constraints)
          Create an AbleSelector object
 
Method Summary
 void addConstraint(java.lang.Object constraint)
          Add a Clause or Predicate constraint to this selector
 java.lang.String arlString()
          Return a formal ARL string that describes this clause.
 void convertExpressionToClauses(AbleRuleSet theRuleSet)
          Convert the constraintExpression to a Vector of AbleAntecedentClauses
static java.lang.String Copyright()
          Determine the copyright of this class.
 AbleExpression getConstraintExpression()
          Retrieve the constraint expression
 java.util.Vector getConstraints()
          Retrieve the list of constraints (antecedent clauses)
 java.lang.Object getSelectorValue()
          Return the value of the selector variable
 AbleVariable getSelectorVariable()
          Return the selector variable
 java.lang.String getTemplateString(java.util.Vector theTemplateVars)
          Retrieve a text format string for use by rule templates.
 boolean isNegative()
          Check if selector is negative (checking for patterns that don't exist)
 boolean isPositive()
          Check if selector is positive (looking for matches)
 java.util.Vector match(AbleWorkingMemory workingMemory)
          Find a list of matching instances in working memory
 java.lang.String traceString(int theTraceStringFlavor)
          Retrieve a string describing (the contents of) the object.
 java.lang.String xmlString()
          Return a formal XML string that describes this clause.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

constraints

protected java.util.Vector constraints

selectorVariable

protected AbleVariable selectorVariable

positive

protected boolean positive

constraintExpr

protected AbleExpression constraintExpr

myRuleSet

protected AbleRuleSet myRuleSet
Constructor Detail

AbleSelector

public AbleSelector()
Create an AbleSelector object

AbleSelector

public AbleSelector(AbleVariable selector,
                    java.util.Vector constraints)
Create an AbleSelector object
Parameters:
selector - The selector variable
constraints - A vector of constraints on the values bound to the selector variable The constraints are AbleAntecedentClause objects

AbleSelector

public AbleSelector(AbleRuleSet theRuleSet,
                    AbleVariable selector,
                    java.util.Vector constraints,
                    boolean positive)
Construct a selector object
Parameters:
theRuleSet - The ruleset object this selector belongs to
selector - The selector variable
constraints - A vector of constraints on the values bound to the selector variable The constraints are AbleAntecedentClause objects
positive - A boolean , true if the selector is positive, false if negative

AbleSelector

public AbleSelector(AbleVariable selector,
                    AbleExpression constraintExpr,
                    boolean positive)
Construct a selector object
Parameters:
theRuleSet - The ruleset object this selector belongs to
selector - The selector variable
constraints - A vector of constraints on the values bound to the selector variable The constraints are AbleAntecedentClause objects
positive - A boolean , true if the selector is positive, false if negative

AbleSelector

public AbleSelector(AbleVariable selector,
                    java.lang.Object constraintExpr,
                    boolean positive)
             throws AbleParException
Construct a selector object
Parameters:
selector - The selector variable
constraints - A vector of constraints on the values bound to the selector variable The constraints are AbleAntecedentClause objects
positive - A boolean , true if the selector is positive, false if negative
Method Detail

addConstraint

public void addConstraint(java.lang.Object constraint)
Add a Clause or Predicate constraint to this selector
Parameters:
constraint - An AntecedentClause that places a constraint on instances bound to the selector

isPositive

public boolean isPositive()
Check if selector is positive (looking for matches)

isNegative

public boolean isNegative()
Check if selector is negative (checking for patterns that don't exist)

match

public java.util.Vector match(AbleWorkingMemory workingMemory)
                       throws AbleDataException
Find a list of matching instances in working memory
Parameters:
workingMemory - The associated working memory to be searched

getSelectorVariable

public AbleVariable getSelectorVariable()
Return the selector variable

getSelectorValue

public java.lang.Object getSelectorValue()
                                  throws AbleDataException
Return the value of the selector variable

getConstraints

public java.util.Vector getConstraints()
Retrieve the list of constraints (antecedent clauses)

getConstraintExpression

public AbleExpression getConstraintExpression()
Retrieve the constraint expression

convertExpressionToClauses

public void convertExpressionToClauses(AbleRuleSet theRuleSet)
Convert the constraintExpression to a Vector of AbleAntecedentClauses
Parameters:
theRuleSet - An AbleRuleSet objet

arlString

public java.lang.String arlString()
Return a formal ARL string that describes this clause.

For antecedent clauses, add the weight of the clause, but only if the weight is something other than the default weight.

Returns:
A String that describes this clause in formal rule language.

xmlString

public java.lang.String xmlString()
Return a formal XML string that describes this clause.

For antecedent clauses, add the weight of the clause, but only if the weight is something other than the default weight.

Returns:
A String that describes this clause 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.
Parameters:
theTemplateVars - An ordered list of template variables referenced by this selector.
Returns:
A Text format string used to create a new rule instance.
See Also:
AbleRuleTemplate

traceString

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

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

Copyright

public static java.lang.String Copyright()
Determine the copyright of this class.
Returns:
A String containing this class's copyright statement.


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

(C) Copyright IBM Corporation 1999, 2003