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 AbleAntecedentClause

    java.lang.Object
      com.ibm.able.rules.AbleClause
          com.ibm.able.rules.AbleAntecedentClause

All Implemented Interfaces:
  java.io.Serializable

public class AbleAntecedentClause
extends AbleClause
implements java.io.Serializable

This class is used to represent an antecedent boolean or fuzzy expression in a conditional if-then rule. When evaluated using boolean logic, an antecedent clause can return one of three values as its truth value: true, false, and null, which is the case if either of the clause's arguments is null. Each time an antecedent clause is evaluated in boolean logic, the truth value is cached. This helps prevent the clause from being re-valuated unnecessarily.

When evaluated in fuzzy logic, a fuzzy truth value is returned, which may be influenced by the clause's weight.

See Also:
  Serialized Form

Field Summary
`static double` | `ClauseWeightDefault` A default weight.
`protected java.lang.Boolean` | `myBooleanTruth` myBooleanTruth contains the current truth value of this clause, but only if the clause has been evaluated.
`protected double` | `myClauseWeight` myClauseWeight represents the weight that this clause is to assume when the clause is evaluated.

Fields inherited from class com.ibm.able.rules.AbleClause
`myLhs, myLocation, myOp, myRhs, myRuleRefs`

Constructor Summary
`AbleAntecedentClause(AbleExpression theExpression)` Create a new clause from the specified expression.
`AbleAntecedentClause(AbleRd theLhs, int theOp, AbleRd theRhs)` Create a new clause with the specified parts.
`AbleAntecedentClause(AbleRd theLhs, int theOp, AbleRd theRhs, double theClauseWeight)` Create a new antecedent clause with the specified parts.

Method Summary
`java.lang.String` | `arlString()` Return a formal ARL string that describes this clause.
`AbleAntecedentClause` | `createMatchClause(java.util.Hashtable replacementVars)` Create a duplicate of this clause using replacement vars
`protected boolean` | `equals(AbleAntecedentClause theAbleClause)` Determine whether this clause is equal to some other clause.
`java.lang.Boolean` | `getBooleanTruth()` Retrieve the clause's truth value.
`double` | `getClauseWeight()` Retrieve the clause's weight.
`java.lang.String` | `getTemplateString(java.util.Vector theTemplateVars)` Retrieve a text format string for use by rule templates.
`int` | `hashCode()`
`void` | `setBooleanTruth(java.lang.Boolean theTruth)` Set the clause's truth value.
`void` | `setClauseWeight(double theClauseWeight)` Set the clause's weight to the specified value.
`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 that describes this clause.

Methods inherited from class com.ibm.able.rules.AbleClause
`addRuleRef, equals, getLhs, getLhsReferent, getLocation, getOp, getOpAsString, getReferent, getReferents, getRhs, getRhsReferent, getRule, getRuleRefs, setLocation`

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

Field Detail

### ClauseWeightDefault

    public static final double ClauseWeightDefault

  A default weight.

  See Also:
    Constant Field Values

### myClauseWeight

    protected double myClauseWeight

  myClauseWeight represents the weight that this clause is to assume when the clause is evaluated. This field is initialized to ClauseWeightDefault, which means "unweighted".

### myBooleanTruth

    protected java.lang.Boolean myBooleanTruth

  myBooleanTruth contains the current truth value of this clause, but only if the clause has been evaluated. The current value is always either true, false, or null. null means that the truth value is unknown or cannot be determined, perhaps because one of the operands has not been set. This field is initialized to null.

Constructor Detail

### AbleAntecedentClause

    public AbleAntecedentClause(AbleRd theLhs,
                                int theOp,
                                AbleRd theRhs,
                                double theClauseWeight)

  Create a new antecedent clause with the specified parts.

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.

  `theClauseWeight` - The weight of the clause (used by Fuzzy engine only).

### AbleAntecedentClause

    public AbleAntecedentClause(AbleRd theLhs,
                                int theOp,
                                AbleRd theRhs)

  Create a new clause with the specified parts. The clause's weight is set to ClauseWeightDefault (unweighted).

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.

### AbleAntecedentClause

    public AbleAntecedentClause(AbleExpression theExpression)
                         throws AbleDataException

  Create a new clause from the specified expression. If, for some reason the expression cannot be represented as an antecedent clause, an exception will be thrown.

Parameters:
  `theExpression` - A simple boolean expression with an optional weight

Method Detail

### createMatchClause

    public AbleAntecedentClause createMatchClause(java.util.Hashtable replacementVars)

  Create a duplicate of this clause using replacement vars

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

  Specified by:
    `arlString` in class `AbleClause`
  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.

  Specified by:
    `xmlString` in class `AbleClause`
  Returns:
    A String that describes this clause in XML.

### getTemplateString

    public java.lang.String getTemplateString(java.util.Vector theTemplateVars)

  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 rule.
  Returns:
    A Text format string used to create a new rule instance.
  See Also:
    `AbleRuleTemplate`

### setClauseWeight

    public final void setClauseWeight(double theClauseWeight)

  Set the clause's weight to the specified value. The new weight replaces the current weight.

  Parameters:
    `theClauseWeight` - The new weight of the clause.

### getClauseWeight

    public final double getClauseWeight()

  Retrieve the clause's weight.

  Returns:
    The clause's weight.

### setBooleanTruth

    public final void setBooleanTruth(java.lang.Boolean theTruth)

  Set the clause's truth value.

  Parameters:
    `theTruth` - true if the clause evaluates to true; false if the clause evaluates to false; null if the truth value is unknown.

### getBooleanTruth

    public final java.lang.Boolean getBooleanTruth()

  Retrieve the clause's truth value.

  Returns:
    true if the clause evaluates to true; false if the clause evaluates to false; null if the truth value is unknown.

### equals

    protected boolean equals(AbleAntecedentClause theAbleClause)

  Determine whether this clause is equal to some other clause.

  For the clauses to be considered equal:

  - The left-hand sides must be ==
  - The operators must be ==
  - The right-hand sides must be ==
  - The clause weights must be ==

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

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

### hashCode

    public int hashCode()

  Overrides:
    `hashCode` in class `AbleClause`

### toString

    public java.lang.String toString()

  Retrieve a string describing (the contents of) the object.

  Overrides:
    `toString` in class `AbleClause`
  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 `AbleClause`
  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