public class AstConst extends AstParameter
Modifier and Type | Field and Description |
---|---|
static AstConst |
E |
static AstConst |
FALSE |
static AstConst |
NAN |
static AstConst |
PI |
static AstConst |
TRUE |
Constructor and Description |
---|
AstConst() |
AstConst(java.lang.String name,
double d) |
Modifier and Type | Method and Description |
---|---|
ValNum |
exec(Env env)
"Execute" this AST expression, and return the result.
|
java.lang.String |
str()
String representation of this Ast object in the Rapids language.
|
columns, description, example, toJavaString
asBytes, clone, copyOver, frozenType, read, readExternal, readJSON, reloadFromBytes, toJsonBytes, toJsonString, write, writeExternal, writeJSON
public static final AstConst FALSE
public static final AstConst TRUE
public static final AstConst NAN
public static final AstConst PI
public static final AstConst E
public AstConst()
public AstConst(java.lang.String name, double d)
public java.lang.String str()
AstRoot
AstPrimitive
s this is the name of the function; for
AstParameter
s this is either the name of the variable, or the
value of the numeric constant that the parameter represents. For more
complicated constructs such as AstExec
or AstFunction
this method should return those objects as a Rapids string.public ValNum exec(Env env)
AstRoot
"Execute" this AST expression, and return the result. For different ASTs this may have different interpretation. For example, consider this Rapids expression:
(mean frame True False)
It will be parsed into the following structure:
AstExec() instance with _asts = [AstMean() singleton instance, new AstId(frame), AstConst.TRUE, AstConst.FALSE]
Execution of AstExec
will execute its first argument, _asts[0],
verify that it produces a function (ValFun
), then call
AstPrimitive.apply(Env, Env.StackHelp, AstRoot[])
on that function
passing down the list of _asts arguments.
The AstMean
class will in turn execute all its arguments,
where execution of AstId
fetches the referred symbol from the
environment, and execution of AstConst
returns the value of that
constant.
Certain other functions may choose not to evaluate all their arguments (for example boolean expressions providing short-circuit evaluation).