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.data
Class AbleExpression

    java.lang.Object
      com.ibm.able.data.AbleLiteral
          com.ibm.able.data.AbleExpression

All Implemented Interfaces:
  AbleRd, java.io.Serializable

public class AbleExpression
extends AbleLiteral

An AbleExpression contains a unary or binary operator along with one or two AbleRd objects (which themselves could be AbleExpressions).

See Also:
  Serialized Form

Field Summary
`static double` | `DefaultWeight` A default weight.
`protected AbleRd` | `myLhs` myLhs represents the left-hand side of this clause.
`protected AbleLocation` | `myLocation` The location of this expression in the source ARL file.
`protected int` | `myOp` myOp is the unary or binary 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 AbleRd` | `myValue` myValue represents the value of this expression when the left-hand side and the right-hand side values are computed and the operator is applied.
`protected double` | `myWeight` myWeight represents the weight that this expression should be given when it is converted to an antecedent clause This field is initialized to DefaultWeight which means "unweighted".

Constructor Summary
`AbleExpression(AbleDataContext theRuleSet, java.lang.String theExprString)` Create a new expression from the String.
`AbleExpression(AbleRd theLhs, int theOp, AbleRd theRhs)` Create a new clause with the specified parts.

Method Summary
`java.lang.String` | `arlCRdString()` Return a formal ARL "clause read" string that describes this data object.
`java.lang.String` | `armlCRdString()`
`java.util.Vector` | `convertToConjunctiveNormalForm()` Convert this Expression into conjunctive normal form a list of ANDed AbleExpressions
`java.util.Vector` | `convertToDisjunctiveNormalForm()` Convert this Expression into disjunctive normal form a list of ORed AbleExpressions
`AbleExpression` | `createMatchExpression(java.util.Hashtable replacementVars)` Create a duplicate of this expression using replacement vars
`boolean` | `equals(AbleExpression theAbleExpression)` Determine whether this expression is equal to some other expression.
`boolean` | `equals(java.lang.Object theExpr)`
`boolean` | `getBooleanValue()` Retrieve the value of this data object as a boolean value.
`int` | `getDataType()` Retrieve the data type of this data object.
`java.lang.Class` | `getDataTypeClass()` Return expression value data type
`java.lang.String` | `getDataTypeClassName()` Retrieve the name of the class of this object's underlying data type.
`AbleFuzzySet` | `getFuzzyValue()` Retrieve the value of this data object as a fuzzy value.
`java.lang.Object` | `getGenericValue()` Retrieve the value of this data object as an Object.
`AbleRd` | `getLhs()` Retrieve the expression's left-hand side.
`AbleLocation` | `getLocation()` Returns the location of the expression in the source ARL file
`double` | `getNumericValue()` Retrieve the value of this data object as a numeric value.
`int` | `getOp()` Retrieve the expression's operator.
`java.lang.String` | `getOpAsString()` Retrieve the expression's operator in human-readable string form.
`java.util.BitSet` | `getReferents()` Retrieve the Ids of the variables to which this data object refers, if any.
`AbleRd` | `getRhs()` Retrieve the expression's right-hand side.
`java.lang.String` | `getStringValue()` Retrieve the value of this data object as a string value.
`java.lang.String` | `getTemplateString(java.util.Vector theTemplateVars)` Retrieve a text format string for use by rule templates.
`AbleLiteral` | `getValue()` Compute the value of this expression clause and return the value as an AbleLiteral
`java.util.HashSet` | `getVariableReferences()` Retrieve the set of variables (if any) referenced by this expression (and subexpressions)
`double` | `getWeight()` Retrieve the weight used when the expression is converted to an antecedent clause.
`int` | `hashCode()`
`boolean` | `isComplexExpression()` Returns true if either LHS or RHS args are AbleExpressions
`boolean` | `isCompoundExpression()` Returns true if both LHS and RHS args are AbleExpressions
`boolean` | `isConstant()` Returns true if this AbleRd object is a constant value false, if it does not.
`boolean` | `isSimpleExpression()` Returns true if neither the LHS nor RHS args are AbleExpressions
`void` | `setLocation(AbleLocation theLocation)` Set the location of the expression in the source ARL file
`void` | `setWeight(double theWeight)` Set the weight to the specified value.
`java.lang.String` | `traceString(int theTraceStringFlavor)` Retrieve a string describing (the contents of) the object.
`java.lang.String` | `xmlCRdString()` Return a formal XML "clause read" string that describes this data object.

Methods inherited from class com.ibm.able.data.AbleLiteral
`bitwiseAND, bitwiseNOT, bitwiseOR, bitwiseShiftLeft, bitwiseShiftRight, bitwiseShiftRightZeroFill, bitwiseXOR, cmpEq, cmpGt, cmpGtEq, cmpIs, cmpLt, cmpLtEq, cmpNeq, compDivide, compMinus, compModulo, compMultiply, compPlus, compUnaryMinus, getDataTypeAsString, getReferent, logicalAND, logicalNOT, logicalOR, toString`

Methods inherited from class java.lang.Object
`clone, finalize, getClass, 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 unary or binary 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.

### myValue

    protected transient AbleRd myValue

  myValue represents the value of this expression when the left-hand side and the right-hand side values are computed and the operator is applied.

  This field is initialized by the constructor.

### DefaultWeight

    public static final double DefaultWeight

  A default weight.

  See Also:
    Constant Field Values

### myWeight

    protected double myWeight

  myWeight represents the weight that this expression should be given when it is converted to an antecedent clause This field is initialized to DefaultWeight which means "unweighted".

### myLocation

    protected AbleLocation myLocation

  The location of this expression in the source ARL file.

Constructor Detail

### AbleExpression

    public AbleExpression(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.

### AbleExpression

    public AbleExpression(AbleDataContext theRuleSet,
                          java.lang.String theExprString)
                   throws AbleException

  Create a new expression from the String.

Parameters:
  `theRuleSet` - The data context used to parse the String into an expression
  `theExprString` - The expression String.

Method Detail

### createMatchExpression

    public AbleExpression createMatchExpression(java.util.Hashtable replacementVars)

  Create a duplicate of this expression using replacement vars

### getLhs

    public final AbleRd getLhs()

  Retrieve the expression's left-hand side.

  Returns:
    An AbleData left-hand side object.

### getOp

    public final int getOp()

  Retrieve the expression's operator.

  Returns:
    An AbleData.<Operator> constant.

### getOpAsString

    public java.lang.String getOpAsString()

  Retrieve the expression's 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 expression's right-hand side.

  Returns:
    An AbleData "readable" object.

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

  Specified by:
    `getReferents` in interface `AbleRd`
  Overrides:
    `getReferents` in class `AbleLiteral`
  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.

### traceString

    public java.lang.String traceString(int theTraceStringFlavor)

  Description copied from class: `AbleLiteral`
  Retrieve a string describing (the contents of) the object.

  Specified by:
    `traceString` in interface `AbleRd`
  Specified by:
    `traceString` in class `AbleLiteral`
  Parameters:
    `theTraceStringFlavor` - An AbleRuleSet.TraceStringFlavor value.

  Returns:
    A String containing the current contents of the object.
  See Also:
    `AbleLiteral.traceString(int)`

### xmlCRdString

    public java.lang.String xmlCRdString()

  Description copied from class: `AbleLiteral`
  Return a formal XML "clause read" string that describes this data object.

  Specified by:
    `xmlCRdString` in interface `AbleRd`
  Specified by:
    `xmlCRdString` in class `AbleLiteral`
  Returns:
    A String describing the data object in XML.
  See Also:
    `AbleLiteral.xmlCRdString()`

### armlCRdString

    public java.lang.String armlCRdString()

  See Also:
    `AbleLiteral.xmlCRdString()`

### arlCRdString

    public java.lang.String arlCRdString()

  Description copied from class: `AbleLiteral`
  Return a formal ARL "clause read" string that describes this data object.

  Specified by:
    `arlCRdString` in interface `AbleRd`
  Specified by:
    `arlCRdString` in class `AbleLiteral`
  Returns:
    A String describing the data object in formal rule language.
  See Also:
    `AbleLiteral.arlCRdString()`

### convertToConjunctiveNormalForm

    public java.util.Vector convertToConjunctiveNormalForm()

  Convert this Expression into conjunctive normal form a list of ANDed AbleExpressions

  Returns:
    A Vector of AbleExpression objects

### convertToDisjunctiveNormalForm

    public java.util.Vector convertToDisjunctiveNormalForm()

  Convert this Expression into disjunctive normal form a list of ORed AbleExpressions

  Returns:
    A Vector of AbleExpression objects

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

  Specified by:
    `getTemplateString` in interface `AbleRd`
  Overrides:
    `getTemplateString` in class `AbleLiteral`
  Parameters:
    `theTemplateVars` - An ordered list of template variables referenced by this rule.
  Returns:
    A Text format string used to create a new rule instance.

### getValue

    public AbleLiteral getValue()
                         throws AbleDataException

  Compute the value of this expression clause and return the value as an AbleLiteral

  Specified by:
    `getValue` in interface `AbleRd`
  Specified by:
    `getValue` in class `AbleLiteral`
  Returns:
    An AbleLiteral object.
  Throws:
    `AbleDataException` - If the value of this object cannot be represented as a literal.
  See Also:
    `AbleLiteral.getValue()`

### getStringValue

    public java.lang.String getStringValue()
                                    throws AbleDataException

  Description copied from class: `AbleLiteral`
  Retrieve the value of this data object as a string value.

  Specified by:
    `getStringValue` in interface `AbleRd`
  Specified by:
    `getStringValue` in class `AbleLiteral`
  Returns:
    A String, if the value of this object can be represented as a string value.
  Throws:
    `AbleDataException` - If the value of this object cannot be represented as a string value.
  See Also:
    `AbleLiteral.getStringValue()`

### getNumericValue

    public double getNumericValue()
                           throws AbleDataException

  Description copied from class: `AbleLiteral`
  Retrieve the value of this data object as a numeric value.

  Specified by:
    `getNumericValue` in interface `AbleRd`
  Specified by:
    `getNumericValue` in class `AbleLiteral`
  Returns:
    A double, if the value of this object can be represented as a numeric value.
  Throws:
    `AbleDataException` - If the value of this object cannot be represented as a numeric value.
  See Also:
    `AbleLiteral.getNumericValue()`

### getGenericValue

    public java.lang.Object getGenericValue()
                                     throws AbleDataException

  Description copied from class: `AbleLiteral`
  Retrieve the value of this data object as an Object.

  Specified by:
    `getGenericValue` in interface `AbleRd`
  Specified by:
    `getGenericValue` in class `AbleLiteral`
  Returns:
    A Boolean, Double, String or Object object depending on the derived class.
  Throws:
    `AbleDataException` - If the value of this object cannot be represented as an Object.
  See Also:
    `AbleLiteral.getGenericValue()`

### getFuzzyValue

    public AbleFuzzySet getFuzzyValue()
                               throws AbleDataException

  Description copied from class: `AbleLiteral`
  Retrieve the value of this data object as a fuzzy value.

  Specified by:
    `getFuzzyValue` in interface `AbleRd`
  Specified by:
    `getFuzzyValue` in class `AbleLiteral`
  Returns:
    A fuzzy set, if the value of this object can be represented as a fuzzy value.
  Throws:
    `AbleDataException` - If the value of this object cannot be represented as a fuzzy value.
  See Also:
    `AbleLiteral.getFuzzyValue()`

### getBooleanValue

    public boolean getBooleanValue()
                            throws AbleDataException

  Description copied from class: `AbleLiteral`
  Retrieve the value of this data object as a boolean value.

  Specified by:
    `getBooleanValue` in interface `AbleRd`
  Specified by:
    `getBooleanValue` in class `AbleLiteral`
  Returns:
    A boolean, if the value of this object can be represented as a boolean value.
  Throws:
    `AbleDataException` - If the value of this object cannot be represented as a boolean value.
  See Also:
    `AbleLiteral.getBooleanValue()`

### getDataTypeClass

    public java.lang.Class getDataTypeClass()

  Return expression value data type

  Specified by:
    `getDataTypeClass` in interface `AbleRd`
  Specified by:
    `getDataTypeClass` in class `AbleLiteral`
  Returns:
    The class of the underlying data type.

### getDataTypeClassName

    public java.lang.String getDataTypeClassName()

  Description copied from class: `AbleLiteral`
  Retrieve the name of the class of this object's underlying data type.

  Specified by:
    `getDataTypeClassName` in interface `AbleRd`
  Specified by:
    `getDataTypeClassName` in class `AbleLiteral`
  Returns:
    A String that is the name of the class of the underlying data type.

### setWeight

    public final void setWeight(double theWeight)

  Set the weight to the specified value. The new weight replaces the current weight.

  Parameters:
    `theWeight` - The new weight used if the expression is converted to an antecedent clause.

### getWeight

    public final double getWeight()

  Retrieve the weight used when the expression is converted to an antecedent clause.

  Returns:
    The weight.

### getVariableReferences

    public java.util.HashSet getVariableReferences()

  Retrieve the set of variables (if any) referenced by this expression (and subexpressions)

### equals

    public boolean equals(AbleExpression theAbleExpression)

  Determine whether this expression is equal to some other expression.

  For the expressions to be considered equal:

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

  Parameters:
    `theAbleExpression` - The expression that is to be compared to this expression.

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

### equals

    public boolean equals(java.lang.Object theExpr)

### hashCode

    public int hashCode()

### isSimpleExpression

    public boolean isSimpleExpression()

  Returns true if neither the LHS nor RHS args are AbleExpressions

### isComplexExpression

    public boolean isComplexExpression()

  Returns true if either LHS or RHS args are AbleExpressions

### isCompoundExpression

    public boolean isCompoundExpression()

  Returns true if both LHS and RHS args are AbleExpressions

### isConstant

    public boolean isConstant()

  Description copied from interface: `AbleRd`
  Returns true if this AbleRd object is a constant value false, if it does not.

  Specified by:
    `isConstant` in interface `AbleRd`
  Overrides:
    `isConstant` in class `AbleLiteral`

### getDataType

    public int getDataType()

  Description copied from class: `AbleLiteral`
  Retrieve the data type of this data object.

  Specified by:
    `getDataType` in interface `AbleRd`
  Specified by:
    `getDataType` in class `AbleLiteral`
  Returns:
    An AbleData.<DataType> constant.
  See Also:
    `AbleRd.getDataType()`

### setLocation

    public void setLocation(AbleLocation theLocation)

  Set the location of the expression in the source ARL file

### getLocation

    public AbleLocation getLocation()

  Returns the location of the expression in the source ARL file

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