condor.classad
Class CondExpr

Object
  extended bycondor.classad.Expr
      extended bycondor.classad.CondExpr

public class CondExpr
extends Expr

A conditional expression. An internal (non-leaf) node of an expression tree representing the ternary operator cond ? expr1 : expr2.

Version:
2.2
Author:
Marvin Solomon
See Also:
Expr

Field Summary
 Expr ec
          The condition (first component of the expression).
 Expr ef
          The false part (third component of the expression).
 Expr et
          The true part (second component of the expression).
 
Fields inherited from class condor.classad.Expr
ABSOLUTE_TIME, AND, ATTRIBUTE, BIT_COMPLEMENT, BITAND, BITOR, BITXOR, BOOLEAN, CALL, COND, 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
CondExpr(Expr ec, Expr et, Expr ef)
          Construct a conditional expression from its three components.
 
Method Summary
protected  Expr eval1(Env env)
          Evaluate this Expr.
 int prec()
          The precedence of the operator in this expression node.
 boolean sameAs(Expr other)
          Compare this Expr to another expression to check for "deep structural equality".
 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, is, 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

ec

public final Expr ec
The condition (first component of the expression).


et

public final Expr et
The true part (second component of the expression).


ef

public final Expr ef
The false part (third component of the expression).

Constructor Detail

CondExpr

public CondExpr(Expr ec,
                Expr et,
                Expr ef)
Construct a conditional expression from its three components.

Parameters:
ec - the condition (first component of the expression)
et - the true part (second component of the expression)
ef - the false part (third component of the expression)
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": '(' condition '?' true-part ':' false-part ')', with no extra spaces.

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

sameAs

public boolean sameAs(Expr other)
Compare this Expr to another expression to check for "deep structural equality".

Specified by:
sameAs in class Expr
Parameters:
other - the other expression.
Returns:
true of this and the other expression are isomorphic.

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(Env env)
Evaluate this Expr. This is the internal method used to implement Expr.eval().

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.