condor.classad
Class Op

Object
  |
  +--condor.classad.Expr
        |
        +--condor.classad.Op

public class Op
extends Expr

A unary or binary expression. An internal (non-leaf) node of an expression tree representing a unary or binary operator applied to one or two operands.

Version:
2.0
Author:
Marvin Solomon
See Also:
Expr

Nested Class Summary
 
Nested classes inherited from class condor.classad.Expr
Expr.Env
 
Field Summary
 Expr arg1
          The first (or only) operand.
 Expr arg2
          The second operand; null if the operator is unary.
 int op
          The top-level operator.
 
Fields inherited from class condor.classad.Expr
ABSOLUTE_TIME, AND, ATTRIBUTE, BIT_COMPLEMENT, BITAND, BITOR, BITXOR, BOOLEAN, CALL, COND, dateAndTimeFormat, dateFormat, dblevel, DIFFERENT, DIV, EQUAL, ERROR, GREATER, GREATER_EQ, INTEGER, LEFT_SHIFT, LESS, LESS_EQ, LIST, MAXPREC, MINUS, MOD, NOT, NOT_EQUAL, OP, opName, opNameXML, OR, PLUS, REAL, RECORD, RELATIVE_TIME, RIGHT_SHIFT, SAME, SELECTION, STRING, SUBSCRIPT, TIMES, type, UMINUS, UNDEFINED, UPLUS, URIGHT_SHIFT
 
Constructor Summary
Op(int op, Expr arg1)
          Construct a node for a unary operator.
Op(int op, Expr arg1, Expr arg2)
          Construct a node for a binary operator.
 
Method Summary
protected  Expr eval1(Expr.Env env)
          Evaluate this Expr.
 int prec()
          The precedence of the operator in this expression node.
 StringBuffer toString(StringBuffer sb)
          Convert this Expr to a string, appending the result to the end of "sb".
 
Methods inherited from class condor.classad.Expr
db, db, eval, eval, intValue, isConstant, isTrue, realValue, selectExpr, stringValue, subExpr, toString, typeName
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

op

public final int op
The top-level operator.

See Also:
Expr.opName

arg1

public final Expr arg1
The first (or only) operand.


arg2

public final Expr arg2
The second operand; null if the operator is unary.

Constructor Detail

Op

public Op(int op,
          Expr arg1,
          Expr arg2)
Construct a node for a binary operator.

Parameters:
op - the operator.
arg1 - the left operand.
arg2 - the right operand.

Op

public Op(int op,
          Expr arg1)
Construct a node for a unary operator.

Parameters:
op - the operator.
arg1 - the operand.
Method Detail

toString

public StringBuffer toString(StringBuffer sb)
Convert this Expr to a string, appending the result to the end of "sb". The representation is the "canonical native format".

Specified by:
toString in class Expr
Parameters:
sb - a place to put the result.
Returns:
sb.
See Also:
ClassAdWriter

prec

public int prec()
The precedence of the operator in this expression node. Used to print expressions without superfluous parentheses.

Specified by:
prec in class Expr
Returns:
the precendence of this node.
See Also:
ClassAdWriter.MINIMAL_PARENTHESES

eval1

protected Expr eval1(Expr.Env env)
Evaluate this Expr. This is the internal method used to implement Expr.eval(). The operands are recursively evaluated and the operator is applied to the values.

Specified by:
eval1 in class Expr
Parameters:
env - an environment used to evaluate the operands. It is cleared to the null environment before return.
Returns:
a Constant representing the value.