|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Object | +--condor.classad.Expr | +--condor.classad.Constant
A constant (Integer, Real, etc.). The constant is wrapped so that it may be used as a node in an expression tree. To conserve space, there is at most one Constant instance with any given value.
Expr
Nested Class Summary |
Nested classes inherited from class condor.classad.Expr |
Expr.Env |
Field Summary | |
static Constant |
CyclicRef
An undefined constant that represents the result a attempting to resovle a cyclic attribute reference as in [a=b;b=a] . |
static Constant |
Error
A default error constant |
static Constant |
False
The unique boolean Constant false |
static Constant |
True
The unique boolean constant true |
static Constant |
Undef
A default undefined constant |
Object |
value
The actual value of this Constant. |
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 |
Method Summary | |
static Constant |
bool(boolean b)
Convenience function: Convert a boolean to Constant.True or Constant.False. |
static Constant |
error(String msg)
Convenience function: Create an ERROR constant containing a particular message. |
static StringBuffer |
escapeString(StringBuffer sb,
String s,
char quote)
Append to sb a quoted version of string, replacing non-printable values by backslash escapes. |
protected Expr |
eval1(Expr.Env env)
Evaluate this Expr. |
static Constant |
getInstance(char[] buf,
int start,
int stop)
Create a String Constant from a character array, processing backslash escapes. |
static Constant |
getInstance(Date value)
Create an absolute time Constant. |
static Constant |
getInstance(double value)
Returns the unique real constant with value "value", creating one if necessary. |
static Constant |
getInstance(int value)
Returns the unique integer constant with value "value", creating one if necessary. |
static Constant |
getInstance(long value)
Returns the unique time constant with value "value", creating one if necessary. |
static Constant |
getInstance(String value)
Returns the unique String constant with value "value", creating one if necessary. |
int |
intValue()
Get the integer value of this Constant if possible. |
boolean |
isTrue()
Convenience function to test whether an expression is the constant TRUE. |
long |
milliseconds()
Convert a time value to milliseconds. |
(package private) static Date |
parseAbsTime(String s)
Helper function for absTime(String). |
(package private) static long |
parseRelTime(String s)
Helper function for relTime(String). |
int |
prec()
The precedence of this expression node (MAXPREC). |
double |
realValue()
Get the double floating point value of this Constant if possible. |
(package private) static String |
rel2str(long t)
Format a relative time value as a readable String. |
String |
stringValue()
Get the string value of this Constant if possible. |
StringBuffer |
toString(StringBuffer sb)
Convert this Expr to a string, appending the result to the end of "sb". |
static Constant |
undefined(String msg)
Convenience function: Create an UNDEFINED constant containing a particular message. |
(package private) static String |
unquoteString(char[] buf,
int start,
int stop)
Generate a string from an array of characters, processing backslash escapes. |
Methods inherited from class condor.classad.Expr |
db, db, eval, eval, isConstant, selectExpr, subExpr, toString, typeName |
Methods inherited from class Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public final Object value
public static final Constant Undef
public static final Constant CyclicRef
[a=b;b=a]
.
public static final Constant Error
public static final Constant True
public static final Constant False
Method Detail |
public static final Constant getInstance(int value)
value
- the value of the Constant.
public static final Constant getInstance(double value)
value
- the value of the Constant.
public static final Constant getInstance(String value)
value
- the value of the Constant, not including any surrounding
quotes.
public static final Constant getInstance(char[] buf, int start, int stop)
buf
- the array of characters.start
- the index preceding the first character to be used.stop
- the index following the last characater to be used.
public static final Constant getInstance(Date value)
value
- the value of the Constant.
public static final Constant getInstance(long value)
value
- the value of the constant in milliseconds
protected Expr eval1(Expr.Env env)
Expr.eval()
.
eval1
in class Expr
env
- an environment used to evaluate the operands. It is cleared
to the null environment before return.
public StringBuffer toString(StringBuffer sb)
toString
in class Expr
sb
- a place to put the result.
ClassAdWriter
public static Constant error(String msg)
msg
- the message.
public static Constant undefined(String msg)
msg
- the message.
public static Constant bool(boolean b)
b
- the boolean value.
public int intValue() throws ArithmeticException
intValue
in class Expr
ArithmeticException
- if this Constant is not an integer.public double realValue() throws ArithmeticException
realValue
in class Expr
ArithmeticException
- if this Constant is not an instance of
IntegerConstant or RealConstant.public String stringValue() throws ArithmeticException
stringValue
in class Expr
ArithmeticException
- if this Constant is not an instance of
StringConstant.public boolean isTrue()
isTrue
in class Expr
public long milliseconds() throws ArithmeticException
ArithmeticException
- if this Constant is not a time value.public int prec()
prec
in class Expr
ClassAdWriter.MINIMAL_PARENTHESES
static final String unquoteString(char[] buf, int start, int stop)
buf
- the array of characters.start
- the index of the first character to be used.stop
- the index following the last characater to be used.
public static StringBuffer escapeString(StringBuffer sb, String s, char quote)
Note that Unicode is not supported: We assume the value of every character is in the range 0..0377.
sb
- a place to put the result.s
- the string to be quoted.quote
- the quote character (' or ").
static final String rel2str(long t)
t
- the number to be converted, in milliseconds.
static long parseRelTime(String s)
s
- the string to parse.
static Date parseAbsTime(String s)
s
- the string to parse.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |