|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Object condor.classad.ClassAd
A library of handy methods for manipulating classad expressions.
The class contains only static methods for performing various operations on
classified advertisements. See Expr
and its various subclasses,
especially RecordExpr
for the actual objects that are manipulated.
Expr
,
RecordExpr
Method Summary | |
static RecordExpr |
bind(RecordExpr ad1,
RecordExpr ad2)
Wrap a pair of ads in an environment defining "self" and "other". |
static Constant |
constant(double x)
Create a constant expression from a real value. |
static Constant |
constant(int i)
Create a constant expression from an integer value. |
static Constant |
constant(String s)
Create a constant expression from a String value. |
static Expr |
eval(RecordExpr ad,
String attr)
Evaluate a selection from a ClassAd. |
static Expr |
eval(RecordExpr ad,
String[] attrs)
Evaluate a selection from a ClassAd. |
static Expr |
eval(String name,
Expr expr,
RecordExpr ad)
Evaluate an expression in the context of a ClassAd. |
static Expr |
eval(String attr,
RecordExpr ad1,
RecordExpr ad2)
Evaluate an attribute of a ClassAd in an environment consisting of a pair of ads. |
static boolean |
loadJavaLibrary(String className)
Loads a "library" of externally defined Java functions. |
static int[] |
match(Expr expr1,
Expr expr2)
Match two ClassAds. |
Methods inherited from class Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
public static RecordExpr bind(RecordExpr ad1, RecordExpr ad2)
env = [ Ad1 = [ other = Ad2.self; self = ad1 ] Ad2 = [ other = Ad1.self; self = ad2 ] ]Inside ad1,
self
refers to ad1
and
other
refers to ad2
, and in inside ad2,
self
refers to ad2
and other
refers to ad1
.
ad1
- the first ClassAdad2
- the second ClassAd
RecordExpr env
such that
env.Ad1.self
is ad1
, and
env.Ad2.self
is ad2
.public static Expr eval(RecordExpr ad, String[] attrs)
ad
- a ClassAd from which to select.attrs
- a sequence attr1, attr2, ..., attrn
of
attribute names.
ad.attr1.attr2...attrn
.public static Expr eval(RecordExpr ad, String attr)
ad
- a ClassAd from which to select.attr
- an attribute name.
ad.attr
.public static Expr eval(String name, Expr expr, RecordExpr ad)
expr
is evaluated as if it were a the value of an
attribute named name
in ad
.
Note: the RecordExpr ad
is modified and then
returned to its original state, so this method is not thread-safe.
name
- the name of the attribute.expr
- the expression to evaluate.ad
- the context for evaluation.
expr
in the context of
ad
.public static Expr eval(String attr, RecordExpr ad1, RecordExpr ad2)
ad1.attr
evaluated in
the environment produced by bind(ad1, ad2)
.
attr
- the name of the attribute used to initiate the evaluationad1
- the ClassAd used to initiate the evaluationad2
- the other ClassAd
bind(RecordExpr,RecordExpr)
public static int[] match(Expr expr1, Expr expr2)
expr1.requirements
and expr2.requirments
both evaluate to true in
the environment produced by bind(expr1, expr2)
, then
the result is the list { rank1, rank2 }
, where
ranki
is the result of evaluating
expri
in bind(expr1, expr2)
.
If either of the requirements
attributes is missing or
evaluates to a value other than true, or if either of the
rank
attributes is missing or evaluates to something other
than an Integer, the result is null.
expr1
- the first expression.expr2
- the second expression.
bind(RecordExpr,RecordExpr)
public static boolean loadJavaLibrary(String className)
Note: Methods not obeying these restrictions will be silently ignored
The methods must be static and return an expression (more precisely, condor.classad.Expr) and have an optional Env parameter followed by either one parameter of type Expr[] or any number of parameters (including zero) all of which are of type Expr. In the former case, the method defines a "varargs" function: It will be called with an array of Expr values representing the (evaluated) actual parameters. In the latter case, a call with the wrong number of arguments will evaluate to ERROR without invoking the method at all. Otherwise, the actual parameters are evaluated and passed to the arguments of the method and the value returned from the method is the value of the call.
If a method has an initial Env parameter, evaluation of the actual parameters is inhibited. The arguments are passed as is to the the Expr or Expr[] formal parameters, and the Env parameter is set to an environment (stack of enclosing Record expressions) that the method can use to evaluate the expressions.
className
- the fully qualified name of the class (e.g.
condor.classad.Builtin)
Env
public static Constant constant(int i)
i
- the value.
public static Constant constant(double x)
x
- the value.
public static Constant constant(String s)
s
- the value.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |