condor.classad
Class AttrRef

Object
  extended bycondor.classad.Expr
      extended bycondor.classad.AttrRef

public class AttrRef
extends Expr

A reference to another attribute. A leaf node in an expression tree that represents an attribute reference.

Version:
2.2
Author:
Marvin Solomon
See Also:
Expr, RecordExpr

Field Summary
 AttrName name
          The string name associated with this reference.
 
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
AttrRef(AttrName name)
          Create a new AttrRef.
AttrRef(String name)
          Create a new AttrRef.
 
Method Summary
protected  Expr eval1(Env env)
          Evaluate this Expr.
 int prec()
          The precedence of this expression.
 boolean sameAs(Expr other)
          Compare this Expr to another expression to check for "deep structural equality".
 String toString()
          Convert this AttrRef to a string.
 StringBuffer toString(StringBuffer sb)
          Convert this AttrRef 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, typeName
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

name

public final AttrName name
The string name associated with this reference.

Constructor Detail

AttrRef

public AttrRef(AttrName name)
Create a new AttrRef.

Parameters:
name - the string name associated with this reference.

AttrRef

public AttrRef(String name)
Create a new AttrRef.

Parameters:
name - the string name associated with this reference.
Method Detail

toString

public String toString()
Convert this AttrRef to a string. The representation is the "canonical native format". If the name is an identifier (a string of letters, digits, and underscores, not starting with a digit), it is just the name itself. Otherwise, it is surrounded with single quotes (apostrophes) and non-printing characters, backslashes and apostrophes are backslash-escaped.

Overrides:
toString in class Expr
Returns:
a string representation of this Expr
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 if "this" and "other" are isomorphic.

toString

public StringBuffer toString(StringBuffer sb)
Convert this AttrRef to a string, appending the result to the end of "sb". The representation is the "canonical native format". If the name is an identifier (a string of letters, digits, and underscores, not starting with a digit), it is just the name itself. Otherwise, it is surrounded with single quotes (apostrophes) and non-printing characters, backslashes and apostrophes are backslash-escaped.

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

eval1

protected Expr eval1(Env env)
Evaluate this Expr. This is the internal method used to implement Expr.eval(). The env is searched for name of this AttrRef. Scopes that do not define that name are popped off the stack, leaving the scope defining the name at the top. If the name is not found in any of the scopes, the env becomes the empty environment, and the result is the UNDEFINED constant.

Specified by:
eval1 in class Expr
Parameters:
env - the environment to search for the name. It is modified in place to indicate where the name was resolved.
Returns:
a Constant, AttrRef, ListExpr, or RecordExpr representing the value.

prec

public int prec()
The precedence of this expression.

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