Extension SDK 10.1.2

oracle.javatools.parser.util
Interface ExpressionObject


public interface ExpressionObject

This is the ExpressionObject interface used by the ExpressionStack. See the ExpressionStack for details. During processing, the expression tree is built via the methods addOperand(...) and closeOperator(...) which are called on operator expressions. Only classify() should be called on the atom expressions.


Field Summary
static int ATOM
          This ExpressionObject is not an operator.
static int INFIX_OP
          This ExpressionObject is an infix operator.
static int LEFT_ASSOC
          This operator is left associativity.
static int MAX_PRECEDENCE
          No ExpressionObject should return a precedence worse than this value.
static int NON_ASSOC
          This operator is non-associative.
static int POSTFIX_OP
          This ExpressionObject is a postfix operator.
static int PREFIX_OP
          This ExpressionObject is a prefix operator.
static int RIGHT_ASSOC
          This operator is right associative.
static int TERNARY_OP
          This ExpressionObject is a ternary operator.
 
Method Summary
 void addOperand(ExpressionObject e)
          Adds an operand to this operator object.
 int classify()
          Returns the whether an ExpressionObject is an atom, a prefix operator, an infix operator, or a postfix operator.
 void closeOperator(java.lang.Object closingArgument)
          Called after all operands have been added to allow post-processing.
 int getAssociativity()
          Returns the associativity of this operator according to the above constants.
 int getPrecedence()
          Returns a positive number representing the precedence of this ExpressionObject operator.
 

Field Detail

ATOM

public static final int ATOM
This ExpressionObject is not an operator.

See Also:
Constant Field Values

PREFIX_OP

public static final int PREFIX_OP
This ExpressionObject is a prefix operator. It takes one operand.

See Also:
Constant Field Values

INFIX_OP

public static final int INFIX_OP
This ExpressionObject is an infix operator. It takes two operands. The operands will be added via addOperand() in order.

See Also:
Constant Field Values

POSTFIX_OP

public static final int POSTFIX_OP
This ExpressionObject is a postfix operator. It takes one operand.

See Also:
Constant Field Values

TERNARY_OP

public static final int TERNARY_OP
This ExpressionObject is a ternary operator. It takes three operands. The infix stream order should be "operand op operand operand".

See Also:
Constant Field Values

MAX_PRECEDENCE

public static final int MAX_PRECEDENCE
No ExpressionObject should return a precedence worse than this value.

See Also:
Constant Field Values

LEFT_ASSOC

public static final int LEFT_ASSOC
This operator is left associativity.

See Also:
Constant Field Values

NON_ASSOC

public static final int NON_ASSOC
This operator is non-associative.

See Also:
Constant Field Values

RIGHT_ASSOC

public static final int RIGHT_ASSOC
This operator is right associative.

See Also:
Constant Field Values
Method Detail

classify

public int classify()
Returns the whether an ExpressionObject is an atom, a prefix operator, an infix operator, or a postfix operator.


getPrecedence

public int getPrecedence()
Returns a positive number representing the precedence of this ExpressionObject operator. The smaller the value, the more tightly binding this operator is. No precedence should exceed MAX_PRECEDENCE. Prefix and postfix operators should not have the same precedence. If so, you may get an incorrect tree.


getAssociativity

public int getAssociativity()
Returns the associativity of this operator according to the above constants. Any two operators that have the same precedence must also share the same associativity. If not, you may get an incorrect tree.


addOperand

public void addOperand(ExpressionObject e)
Adds an operand to this operator object.


closeOperator

public void closeOperator(java.lang.Object closingArgument)
Called after all operands have been added to allow post-processing.

Parameters:
closingArgument - The closing argument passed to the ExpressionStack.

Extension SDK

 

Copyright © 1997, 2004, Oracle. All rights reserved.