condor.classad
Class FuncCall

Object
  extended bycondor.classad.Expr
      extended bycondor.classad.FuncCall

public class FuncCall
extends Expr

A function call. An internal (non-leaf) node of an expression tree representing a function name and list of arguments.

Version:
2.1
Author:
Marvin Solomon
See Also:
Expr

Nested Class Summary
 
Nested classes inherited from class condor.classad.Expr
Expr.Env
 
Field Summary
 Expr[] args
          The parameters to the function.
 AttrName func
          The name of the function as supplied in the original source.
 
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, RECORD, RELATIVE_TIME, RIGHT_SHIFT, SAME, SELECTION, STRING, SUBSCRIPT, TIMES, type, UMINUS, UNDEFINED, UPLUS, URIGHT_SHIFT
 
Method Summary
protected  Expr eval1(Expr.Env env)
          Evaluate this Expr.
static Expr getInstance(AttrName func, List params)
          Create a function node from a name and a list of paramters.
(package private) static boolean loadJavaLibrary(String className)
          Loads a library of externally defined Java functions.
 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

func

public final AttrName func
The name of the function as supplied in the original source.


args

public final Expr[] args
The parameters to the function.

Method Detail

getInstance

public static Expr getInstance(AttrName func,
                               List params)
Create a function node from a name and a list of paramters. This method has a special hack for "constant folding" of certain calls. If the function name is absTime or relTime (ignoring case) and there is exactly one argument, of type String, then return the appropriate constant. In all other cases, just return a new FuncCall object.

Parameters:
func - the name of the function (original case).
params - the parameters supplied.
Returns:
an Exp of type CALL, ABS_TIME, REL_TIME, REAL, or ERROR.

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": name '(' [ arg [ ',' arg ]* ')' with no extra spaces.

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

eval1

protected Expr eval1(Expr.Env env)
Evaluate this Expr. This is the internal method used to implement Expr.eval(). Currently, we assume that all functions are strict in all their arguments, that is, all arguments are evaluated before the function is called, and if any argument evaluates to an undefined or error Constant, the value of the call is undefined or error (with error taking precendence over undefined; the message in a resulting Constant is taken from the first argument that evaluates to an error (or undefined) Constant).

We also assume at this time that there are no built-in functions that take a RecordExpr or ListExpr as an argument.

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.

prec

public int prec()
The precedence of the operator in this expression node. Used to print expressions without superfluous parentheses. Function calls have maximal precedence (higher than any operator).

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

loadJavaLibrary

static boolean loadJavaLibrary(String className)
Loads a library of externally defined Java functions. Meant to be called from ClassAd.loadJavaLibrary.

Parameters:
className - the fully qualified name of the class (e.g. condor.classad.Builtin)
Returns:
false if the load fails.