condor.classad
Class Builtin

Object
  extended bycondor.classad.Builtin

public class Builtin
extends Object

A library of builtin functions. Each function is static and public, excepts an array of Expr as an argument and returns an Expr as a result.

Version:
2.1
Author:
Marvin Solomon
See Also:
FuncCall

Method Summary
static Expr absTime(Expr[] args)
          Convert to absolute time.
static Expr ceiling(Expr arg)
          Returns an integer constant corresponding to the ceiling of the value of arg.
static Expr floor(Expr arg)
          Returns an integer constant corresponding to the floor of the value of arg.
static Expr glob(Expr str, Expr pat)
          Compares a string with a shell-style "glob" pattern.
static Expr gmtTime(Expr secs)
          Convert a time constant to a string in "Unix" format, using GMT.
static Expr gmtTimeString(Expr secs)
          Convert a time constant to a string in "Unix" format, using GMT.
static Expr iglob(Expr str, Expr pat)
          Compares a string with a shell-style "glob" pattern, ignoring case.
static Expr Int(Expr arg)
          Convert to integer.
static Expr localTimeString(Expr secs)
          Convert a time constant to a string in "Unix" format, using the local time zone.
static Expr real(Expr arg)
          Convert to real.
static Expr relTime(Expr arg)
          Convert to relative time.
static Expr round(Expr arg)
          Returns an integer constant corresponding to the value of arg rounded to the nearest integer.
static Expr strcat(Expr[] args)
          Converts each argument to a string and returns the concatenation of the values.
static Expr strcmp(Expr s1, Expr s2)
          Compares two strings.
static Expr stricmp(Expr s1, Expr s2)
          Compares two strings ignoring differences in case.
static Expr string(Expr s)
          Converts the argument to a string.
static Expr substr(Expr[] args)
          Returns a substring of a string.
static Expr timeInterval(Expr secs)
          Convert a number of seconds into a time interval string of the form "days+hh:mm:ss".
static Expr unixTime()
          Get the current time in seconds since the epoch.
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

strcat

public static Expr strcat(Expr[] args)
Converts each argument to a string and returns the concatenation of the values.

Parameters:
args - the arguments
Returns:
the concatenation of the values.

substr

public static Expr substr(Expr[] args)
Returns a substring of a string. This is like the Perl version of substr. Offset is the start of the substr, negative is from the end: 0: first char of string -1: last char of string If length is omitted, it means the rest of the string. If length is negative, that many characters are dropped.

Parameters:
args - the arguments
Returns:
the designated substring

strcmp

public static Expr strcmp(Expr s1,
                          Expr s2)
Compares two strings. The arguments are first converted to strings as if by string().

Parameters:
s1 - the first string.
s2 - the second string.
Returns:
an Integer expression with a value that is less than zero if string(s1) < string(s2), greater than zero if string(s1) > string(s2), and equal to zero if string(s1) &eq; string(s2).

stricmp

public static Expr stricmp(Expr s1,
                           Expr s2)
Compares two strings ignoring differences in case. The arguments are first converted to strings as if by string().

Parameters:
s1 - the first string.
s2 - the second string.
Returns:
an Integer expression with a value that is less than zero if string(s1) < string(s2), greater than zero if string(s1) > string(s2), and equal to zero if string(s1) &eq; string(s2).

glob

public static Expr glob(Expr str,
                        Expr pat)
Compares a string with a shell-style "glob" pattern. The pat string may contain instances of * and/or ?. The result is true if pat matches str and false otherwise. The pattern character ? matches any character; * matches any sequence of zero or more characters. A backslash preceding any pattern character removes any special meaning from that character and makes it match only itself. For example \? matches a question mark and \\ matches a single backslash. Any other character matches only itself. Note that case is significant in the comparison.

Parameters:
str - the string to be compared against
pat - the pattern to match
Returns:
a boolean constant with value true if the pattern matches and false otherwise.

iglob

public static Expr iglob(Expr str,
                         Expr pat)
Compares a string with a shell-style "glob" pattern, ignoring case. The pat string may contain instances of * and/or ?. The result is true if pat matches str and false otherwise. The pattern character ? matches any character; * matches any sequence of zero or more characters. A backslash preceding any pattern character removes any special meaning from that character and makes it match only itself. For example \? matches a question mark and \\ matches a single backslash. A lower-case letter mathches the upper or lower case version of that letter. Any other character (including an upper-case letter) matches only itself.

Parameters:
str - the string to be compared against
pat - the pattern to match
Returns:
a boolean constant with value true if the pattern matches and false otherwise.

Int

public static Expr Int(Expr arg)
Convert to integer. The arg is convered to an integer if possible. Note: This method corresponds to int() in the ClassAd language, because case is ignored in function names. The name "int" cannot be used because it is a reserved word in Java.

Parameters:
arg - the value to be converted.
Returns:
an integer constant corresponding to arg, or ERROR.

real

public static Expr real(Expr arg)
Convert to real. The arg is convered to a real if possible.

Parameters:
arg - the value to be converted.
Returns:
a real constant corresponding to arg, or ERROR.

string

public static Expr string(Expr s)
Converts the argument to a string.

Parameters:
s - str the string to convert.
Returns:
a string represenation of the Expr

relTime

public static Expr relTime(Expr arg)
Convert to relative time.

Parameters:
arg - the value to be converted.
Returns:
a relative time or error constant.

absTime

public static Expr absTime(Expr[] args)
Convert to absolute time.

Parameters:
args - the arguments. May be either a single string (which is parsed as an ISO 8601 date spec), or an optional number of seconds offset from the epoch and optional number of seconds east of Greenwhich.
Returns:
an absolute time or error constant.

floor

public static Expr floor(Expr arg)
Returns an integer constant corresponding to the floor of the value of arg.

Parameters:
arg - the input value.
Returns:
the floor of arg.

ceiling

public static Expr ceiling(Expr arg)
Returns an integer constant corresponding to the ceiling of the value of arg.

Parameters:
arg - the input value.
Returns:
the ceiling of arg.

round

public static Expr round(Expr arg)
Returns an integer constant corresponding to the value of arg rounded to the nearest integer.

Parameters:
arg - the input value.
Returns:
the rounded arg.

unixTime

public static Expr unixTime()
Get the current time in seconds since the epoch. Obsolescent.

Returns:
the current time in seconds.

timeInterval

public static Expr timeInterval(Expr secs)
Convert a number of seconds into a time interval string of the form "days+hh:mm:ss". Obsolescent.

Parameters:
secs - the time interval in seconds.
Returns:
a string version of the interval.

gmtTime

public static Expr gmtTime(Expr secs)
Convert a time constant to a string in "Unix" format, using GMT. This function is obsolescent.

Parameters:
secs - the time in seconds from the epoch.
Returns:
a string in Unix "ctime" format.

gmtTimeString

public static Expr gmtTimeString(Expr secs)
Convert a time constant to a string in "Unix" format, using GMT. This function is obsolescent.

Parameters:
secs - the time in seconds from the epoch.
Returns:
a string in Unix "ctime" format.

localTimeString

public static Expr localTimeString(Expr secs)
Convert a time constant to a string in "Unix" format, using the local time zone. This function is obsolescent.

Parameters:
secs - the time in seconds from the epoch.
Returns:
a string in Unix "ctime" format.