Package org.apache.commons.jxpath.ri.compiler

# Class CoreOperation

java.lang.Object
org.apache.commons.jxpath.ri.compiler.Expression
org.apache.commons.jxpath.ri.compiler.Operation
org.apache.commons.jxpath.ri.compiler.CoreOperation

Direct Known Subclasses:
  `CoreOperationAdd`, `CoreOperationAnd`, `CoreOperationCompare`, `CoreOperationDivide`, `CoreOperationMod`, `CoreOperationMultiply`, `CoreOperationNegate`, `CoreOperationOr`, `CoreOperationRelationalExpression`, `CoreOperationSubtract`, `CoreOperationUnion`

public abstract class CoreOperation extends Operation
The common subclass for tree elements representing core operations like "+", "- ", "*" etc.

- ## Nested Class Summary

  ## Nested classes/interfaces inherited from class org.apache.commons.jxpath.ri.compiler.Expression

  `Expression.PointerIterator, Expression.ValueIterator`

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `protected static final int`
  `ADD_PRECEDENCE`
  Add/subtract precedence
  `protected static final int`
  `AND_PRECEDENCE`
  And precedence
  `protected static final int`
  `COMPARE_PRECEDENCE`
  Compare precedence
  `protected static final int`
  `MULTIPLY_PRECEDENCE`
  Multiply/divide/mod precedence
  `protected static final int`
  `NEGATE_PRECEDENCE`
  Negate precedence
  `protected static final int`
  `OR_PRECEDENCE`
  Or precedence
  `protected static final int`
  `RELATIONAL_EXPR_PRECEDENCE`
  Relational expression precedence
  `protected static final int`
  `UNION_PRECEDENCE`
  Union precedence

  ### Fields inherited from class org.apache.commons.jxpath.ri.compiler.Operation

  `args`

  ### Fields inherited from class org.apache.commons.jxpath.ri.compiler.Expression

  `NOT_A_NUMBER, ONE, ZERO`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `CoreOperation(Expression[] args)`
  Constructs a new CoreOperation.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `Object`
  `compute(EvalContext context)`
  Evaluates the expression.
  `abstract Object`
  `computeValue(EvalContext context)`
  Evaluates the expression.
  `protected abstract int`
  `getPrecedence()`
  Computes the precedence of the operation.
  `abstract String`
  `getSymbol()`
  Returns the XPath symbol for this operation, e.g. "+", "div", etc.
  `protected abstract boolean`
  `isSymmetric()`
  Returns true if the operation is not sensitive to the order of arguments, e.g. "=", "and" etc, and false if it is, e.g
  `String`
  `toString()`

  ### Methods inherited from class org.apache.commons.jxpath.ri.compiler.Operation

  `computeContextDependent, getArguments`

  ### Methods inherited from class org.apache.commons.jxpath.ri.compiler.Expression

  `isContextDependent, iterate, iteratePointers`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- ## Field Details

  - ### OR_PRECEDENCE

    protected static final int OR_PRECEDENCE
    Or precedence
    See Also:
      - Constant Field Values

  - ### AND_PRECEDENCE

    protected static final int AND_PRECEDENCE
    And precedence
    See Also:
      - Constant Field Values

  - ### COMPARE_PRECEDENCE

    protected static final int COMPARE_PRECEDENCE
    Compare precedence
    See Also:
      - Constant Field Values

  - ### RELATIONAL_EXPR_PRECEDENCE

    protected static final int RELATIONAL_EXPR_PRECEDENCE
    Relational expression precedence
    See Also:
      - Constant Field Values

  - ### ADD_PRECEDENCE

    protected static final int ADD_PRECEDENCE
    Add/subtract precedence
    See Also:
      - Constant Field Values

  - ### MULTIPLY_PRECEDENCE

    protected static final int MULTIPLY_PRECEDENCE
    Multiply/divide/mod precedence
    See Also:
      - Constant Field Values

  - ### NEGATE_PRECEDENCE

    protected static final int NEGATE_PRECEDENCE
    Negate precedence
    See Also:
      - Constant Field Values

  - ### UNION_PRECEDENCE

    protected static final int UNION_PRECEDENCE
    Union precedence
    See Also:
      - Constant Field Values

- ## Constructor Details

  - ### CoreOperation

    public CoreOperation(Expression[] args)
    Constructs a new CoreOperation.
    Parameters:
      `args` - Expression[]

- ## Method Details

  - ### compute

    public Object compute(EvalContext context)
    Description copied from class: `Expression`
    Evaluates the expression. If the result is a node set, returns the first element of the node set.
    Specified by:
      `compute` in class `Expression`
    Parameters:
      `context` - evaluation context
    Returns:
      Object

  - ### computeValue

    public abstract Object computeValue(EvalContext context)
    Description copied from class: `Expression`
    Evaluates the expression. If the result is a node set, returns the first element of the node set.
    Specified by:
      `computeValue` in class `Expression`
    Parameters:
      `context` - evaluation context
    Returns:
      Object

  - ### getPrecedence

    protected abstract int getPrecedence()
    Computes the precedence of the operation.
    Returns:
      int precedence

  - ### getSymbol

    public abstract String getSymbol()
    Returns the XPath symbol for this operation, e.g. "+", "div", etc.
    Returns:
      String symbol

  - ### isSymmetric

    protected abstract boolean isSymmetric()
    Returns true if the operation is not sensitive to the order of arguments, e.g. "=", "and" etc, and false if it is, e.g. "<=", "div".
    Returns:
      boolean

  - ### toString

    public String toString()
    Overrides:
      `toString` in class `Object`