|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Object | +--condor.classad.Expr
A node of an expression tree. An Expr is one of
RecordExpr
[name = expr, ... ]
,
SelectExpr
a.b
,
ListExpr
{ expr1, expr2, ... }
,
SubscriptExpr
a[i]
,
CondExpr
a ? b : c
,
Op
FuncCall
AttrRef
Constant
RecordExpr
,
SelectExpr
,
ListExpr
,
SubscriptExpr
,
CondExpr
,
Op
,
FuncCall
,
AttrRef
,
Constant
Nested Class Summary | |
protected static class |
Expr.Env
An environment for evaluating expressions. |
Field Summary | |
static int |
ABSOLUTE_TIME
A type flag indicating that this is an absolute time value |
static int |
AND
Token ID corresponding to the operator &&. |
static int |
ATTRIBUTE
A type flag indicating that this is an attribute reference |
static int |
BIT_COMPLEMENT
Token ID corresponding to the operator unary ~. |
static int |
BITAND
Token ID corresponding to the operator &. |
static int |
BITOR
Token ID corresponding to the operator |. |
static int |
BITXOR
Token ID corresponding to the operator ^. |
static int |
BOOLEAN
A type flag indicating that this is a boolean value |
static int |
CALL
A type flag indicating that this is a function call |
static int |
COND
A type flag indicating that this is a conditional expression |
(package private) static SimpleDateFormat |
dateAndTimeFormat
Format for parsing ISO 8601 date and time |
(package private) static SimpleDateFormat |
dateFormat
Format for parsing ISO 8601 date |
static int |
dblevel
Flag to control level of verbosity of debugging input. |
static int |
DIFFERENT
Token ID corresponding to the operator isnt . |
static int |
DIV
Token ID corresponding to the operator /. |
static int |
EQUAL
Token ID corresponding to the operator ==. |
static int |
ERROR
A type flag indicating that this is an error value |
static int |
GREATER
Token ID corresponding to the operator >. |
static int |
GREATER_EQ
Token ID corresponding to the operator >=. |
static int |
INTEGER
A type flag indicating that this is an integer value |
static int |
LEFT_SHIFT
Token ID corresponding to the operator <<. |
static int |
LESS
Token ID corresponding to the operator <. |
static int |
LESS_EQ
Token ID corresponding to the operator <=. |
static int |
LIST
A type flag indicating that this is a list |
protected static int |
MAXPREC
The maximum precedence in the grammar for ClassAd expressions. |
static int |
MINUS
Token ID corresponding to the operator -. |
static int |
MOD
Token ID corresponding to the operator %. |
static int |
NOT
Token ID corresponding to the operator unary !. |
static int |
NOT_EQUAL
Token ID corresponding to the operator !=. |
static int |
OP
A type flag indicating that this is a unary or binary operator |
static String[] |
opName
A table mapping operator codes to character-string names. |
static String[] |
opNameXML
A table mapping operator codes to character-string names, escaped for XML. |
static int |
OR
Token ID corresponding to the operator ||. |
static int |
PLUS
Token ID corresponding to the operator +. |
static int |
REAL
A type flag indicating that this is a real value |
static int |
RECORD
A type flag indicating that this is a record (classad) |
static int |
RELATIVE_TIME
A type flag indicating that this is a relative time value |
static int |
RIGHT_SHIFT
Token ID corresponding to the operator >>. |
static int |
SAME
Token ID corresponding to the operator is . |
static int |
SELECTION
A type flag indicating that this is a selection (a.b) |
static int |
STRING
A type flag indicating that this is a string value |
static int |
SUBSCRIPT
A type flag indicating that this is a selection (a.b) |
static int |
TIMES
Token ID corresponding to the operator *. |
int |
type
The "type" of this expression. |
static int |
UMINUS
Token ID corresponding to the operator unary -. |
static int |
UNDEFINED
A type flag indicating that this is an undefined value |
static int |
UPLUS
Token ID corresponding to the operator unary +. |
static int |
URIGHT_SHIFT
Token ID corresponding to the operator >>>. |
Constructor Summary | |
protected |
Expr(int type)
Create an Expr node of a given type. |
Method Summary | |
static void |
db(boolean newline,
Object msg)
Debugging print. |
static void |
db(Object msg)
Debugging print. |
Expr |
eval()
Evaluate this Expr in a "top-level" (empty) environment. |
Expr |
eval(Expr.Env env)
Evaluate this Expr in a given environment. |
protected abstract Expr |
eval1(Expr.Env env)
Evaluate this Expr. |
int |
intValue()
Convert to an integer constant if possible. |
protected boolean |
isConstant()
Check whether this Expr is a constant. |
boolean |
isTrue()
Convert to a boolean value. |
(package private) abstract int |
prec()
The precedence of the operator in this expression node. |
double |
realValue()
Convert to a double value if possible. |
SelectExpr |
selectExpr(String selector)
A convenience function for creating a SelectExpression corresponding to ``this.selector'' |
String |
stringValue()
Convert to a String value, if possible. |
SubscriptExpr |
subExpr(int subscript)
A convenience function for creating a SubscriptExpression corresponding to ``this[subscript]'' |
String |
toString()
Convert this Expr to a string. |
abstract StringBuffer |
toString(StringBuffer sb)
Convert this Expr to a string, appending the result to the end of "sb". |
protected String |
typeName()
Determine the type of this expression (for printing messages). |
Methods inherited from class Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public final int type
For non-atomic values, the type is one of COND, OP, CALL, SELECTION, SUBSCRIPT, ATTRIBUTE, LIST, or RECORD.
The values of these constants are chosen to facilitate classifying an expression as a constant, constructed value (LIST or RECORD) or other expression.
isConstant()
,
eval(condor.classad.Expr.Env)
public static final int COND
public static final int OP
public static final int CALL
public static final int SELECTION
public static final int SUBSCRIPT
public static final int ATTRIBUTE
public static final int LIST
public static final int RECORD
public static final int UNDEFINED
public static final int ERROR
public static final int BOOLEAN
public static final int INTEGER
public static final int REAL
public static final int STRING
public static final int ABSOLUTE_TIME
public static final int RELATIVE_TIME
static SimpleDateFormat dateAndTimeFormat
static SimpleDateFormat dateFormat
protected static final int MAXPREC
public static int dblevel
public static final String[] opName
opName[NOT_EQUAL] = "!="
.
public static final String[] opNameXML
opName[LEFT_SHIFT] = "<<"
.
public static final int OR
public static final int AND
public static final int BITOR
public static final int BITXOR
public static final int BITAND
public static final int EQUAL
public static final int NOT_EQUAL
public static final int SAME
public static final int DIFFERENT
public static final int LESS
public static final int GREATER
public static final int LESS_EQ
public static final int GREATER_EQ
public static final int LEFT_SHIFT
public static final int RIGHT_SHIFT
public static final int URIGHT_SHIFT
public static final int PLUS
public static final int MINUS
public static final int TIMES
public static final int DIV
public static final int MOD
public static final int UPLUS
public static final int UMINUS
public static final int BIT_COMPLEMENT
public static final int NOT
Constructor Detail |
protected Expr(int type)
Method Detail |
protected String typeName()
protected abstract Expr eval1(Expr.Env env)
eval()
.
Each type of expression implements it differently. Lists, records, and
constants evaluate to themselves. Function calls and operators evaluate
to the result of applying the operartor or function to the (recursively
evaluated) arguments. Attribute references are evaluated by looking up
the reference in the env.
env
- an environment consisting of a list of RecordExprs (innermost
first) used to resolve AttrRefs. In the case of AttrRef, env is updated
to remove all scopes preceding the one where the reference was resovled.
public Expr eval(Expr.Env env)
env
- an environment consisting of a list of RecordExprs (innermost
first) used to resolve AttrRefs. In the case of AttrRef, env is updated
to remove all scopes preceding the one where the reference was resovled.
public Expr eval()
public SelectExpr selectExpr(String selector)
selector
- a selector.
public SubscriptExpr subExpr(int subscript)
protected final boolean isConstant()
public String toString()
toString
in class Object
ClassAdWriter
public abstract StringBuffer toString(StringBuffer sb)
sb
- a place to put the result.
ClassAdWriter
public int intValue() throws ArithmeticException
ArithmeticException
- if this Expr is not an integer Constant.public double realValue() throws ArithmeticException
ArithmeticException
- if this Expr is not an integer or
real constant.public String stringValue() throws ArithmeticException
ArithmeticException
- if this Expr is not an String Constant.public boolean isTrue()
abstract int prec()
ClassAdWriter.MINIMAL_PARENTHESES
public static void db(Object msg)
if (dblevel > 1) db("The value of foo is " +foo);
msg
- the message to be printed.dblevel
public static void db(boolean newline, Object msg)
newline
- if true, terminate the message with a newline.msg
- the message to be printed.db(java.lang.Object)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |