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

com.ibm.able.rules
Class AbleClause

java.lang.Object
  |
  +--com.ibm.able.rules.AbleClause
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
AbleAntecedentClause, AbleAssertionClause, AbleConsequentClause

public abstract class AbleClause
extends java.lang.Object
implements java.io.Serializable

This class is an abstract base class that contains a function or method call, or a unary or binary relation between two Able data objects. Clauses are used in AbleConditionalRules.

See Also:
Serialized Form

Field Summary
protected  AbleRd myLhs
          myLhs represents the left-hand side of this clause.
protected  int myOp
          myOp is the relational operator to be used to evaluate the left-hand side of this clause against the right-hand side of this clause.
protected  AbleRd myRhs
          myRhs represents the right-hand side of this clause.
protected  java.util.Vector myRuleRefs
          myRuleRefs is a list of rules (AbleRule objects) that refer to this clause.
 
Constructor Summary
protected AbleClause(AbleRd theLhs, int theOp, AbleRd theRhs)
          Create a new clause with the specified parts.
 
Method Summary
 void addRuleRef(AbleRule theRule)
          Register a rule that refers to this clause.
protected abstract  java.lang.String arlString()
          Return a formal rule language string that describes this clause.
static java.lang.String Copyright()
          Determine the copyright of this class.
protected  boolean equals(AbleClause theAbleClause)
          Determine whether this clause is equal to some other clause.
 AbleRd getLhs()
          Retrieve the clause's left-hand side.
protected  int getLhsReferent()
          Retrieve the unique Id of the AbleData object on this clause's left-hand side.
 int getOp()
          Retrieve the clause's relational operator.
 java.lang.String getOpAsString()
          Retrieve the clause's relational operator in human-readable string form.
protected  int getReferent()
          Retrieve the unique Id of the AbleData object on this clause's right-hand side.
 java.util.BitSet getReferents()
          Retrieve the Ids of the variables to which this data object refers, if any.
 AbleRd getRhs()
          Retrieve the clause's right-hand side.
protected  int getRhsReferent()
          Retrieve the unique Id of the AbleData object on this clause's right-hand side.
 AbleRule getRule()
          Retrieve the first rule on the rule reference list.
 java.util.Vector getRuleRefs()
          Retrieve the list of rules that refer to this clause.
 java.lang.String toString()
          Retrieve a string describing (the contents of) the object.
protected abstract  java.lang.String traceString(int theTraceStringFlavor)
          Retrieve a string describing (the contents of) the object.
protected abstract  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, wait, wait, wait
 

Field Detail

myLhs

protected AbleRd myLhs
myLhs represents the left-hand side of this clause. This field is initialized by the constructor.

myOp

protected int myOp
myOp is the relational operator to be used to evaluate the left-hand side of this clause against the right-hand side of this clause. The value must be an AbleData.<Operator> constant. This field is initialized by the constructor.

myRhs

protected AbleRd myRhs
myRhs represents the right-hand side of this clause. This field is initialized by the constructor.

myRuleRefs

protected java.util.Vector myRuleRefs
myRuleRefs is a list of rules (AbleRule objects) that refer to this clause.
Constructor Detail

AbleClause

protected AbleClause(AbleRd theLhs,
                     int theOp,
                     AbleRd theRhs)
Create a new clause with the specified parts.

If either the left-hand side or the right-hand side is a variable, and that variable is keeping track of clauses in which the variable is referenced, the variable's set of references is updated to point to this clause.

Parameters:
theLhs - The left-hand side of the clause.

theOp - A relational operator with which to evaluate the two sides, or operands, of this clause. The value must be an AbleData.<Operator> constant.

theRhs - The right-hand side of the clause.

Method Detail

arlString

protected abstract java.lang.String arlString()
Return a formal rule language string that describes this clause.
Returns:
A String that describes this clause in formal rule language.

xmlString

protected abstract java.lang.String xmlString()
Return a formal XML string that describes this clause.
Returns:
A String that describes this clause in XML.

traceString

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

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

getLhs

public final AbleRd getLhs()
Retrieve the clause's left-hand side.
Returns:
An AbleData left-hand side object.

getOp

public final int getOp()
Retrieve the clause's relational operator.
Returns:
An AbleData.<Operator> constant.

getOpAsString

public java.lang.String getOpAsString()
Retrieve the clause's relational operator in human-readable string form.
Returns:
A string of the form: "n:AbleData.<Operator>", where n is the actual constant and "<Operator>" is the name of the constant.

getRhs

public final AbleRd getRhs()
Retrieve the clause's right-hand side.
Returns:
An AbleData "readable" object.

addRuleRef

public void addRuleRef(AbleRule theRule)
Register a rule that refers to this clause.
Parameters:
theRule - A rule object that refers to this clause.


getRuleRefs

public final java.util.Vector getRuleRefs()
Retrieve the list of rules that refer to this clause.
Returns:
The list of rules in which this clause is used.

getRule

public AbleRule getRule()
Retrieve the first rule on the rule reference list.
Returns:
The first rule on the list.

getLhsReferent

protected int getLhsReferent()
Retrieve the unique Id of the AbleData object on this clause's left-hand side.
Returns:
A unique Id if the left-hand side object is a variable; otherwise AbleData.VarIdNull.

getRhsReferent

protected int getRhsReferent()
Retrieve the unique Id of the AbleData object on this clause's right-hand side.
Returns:
A unique Id if the right-hand side object is a variable; otherwise AbleData.VarIdNull.

getReferent

protected int getReferent()
Retrieve the unique Id of the AbleData object on this clause's right-hand side.
Returns:
A unique Id if the right-hand side object is a variable; otherwise AbleData.VarIdNull.

getReferents

public java.util.BitSet getReferents()
Retrieve the Ids of the variables to which this data object refers, if any. Must be overriden by subclasses which can refer to variables.
Returns:
The Ids of the variables to which this data object refers, or AbleData.VarIdNull if the data object is a literal and therefore refers to no variable.

equals

protected boolean equals(AbleClause theAbleClause)
Determine whether this clause is equal to some other clause.

For the clauses to be considered equal:

Parameters:
theAbleClause - The clause that is to be compared to this clause.

Returns:
true if the clauses are equal; false otherwise.

toString

public java.lang.String toString()
Retrieve a string describing (the contents of) the object.
Overrides:
toString in class java.lang.Object
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