public class AstDistance extends AstBuiltin<AstDistance>
Modifier and Type | Class and Description |
---|---|
static class |
AstDistance.DistanceComputer |
Constructor and Description |
---|
AstDistance() |
Modifier and Type | Method and Description |
---|---|
Val |
apply(Env env,
Env.StackHelp stk,
AstRoot[] asts)
Primary method to invoke this function, passing all the parameters
as the `asts` list.
|
java.lang.String[] |
args()
List of argument names.
|
Val |
computeCosineDistances(Frame references,
Frame queries,
java.lang.String distanceMetric) |
java.lang.String |
description()
Return the detailed description (help) for what this language construct
does or how it is supposed to be used.
|
int |
nargs()
Number of function's arguments + 1.
|
java.lang.String |
str()
String representation of this Ast object in the Rapids language.
|
exec
example, exec
asBytes, clone, copyOver, frozenType, read, readExternal, readJSON, reloadFromBytes, toJsonBytes, toJsonString, write, writeExternal, writeJSON
public java.lang.String[] args()
AstPrimitive
args
in class AstPrimitive<AstDistance>
public int nargs()
AstPrimitive
nargs
in class AstPrimitive<AstDistance>
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.str
in class AstRoot<AstDistance>
public java.lang.String description()
AstRoot
Return the detailed description (help) for what this language construct
does or how it is supposed to be used. This method is used in conjunction
with AstRoot.example()
to build the documentation of the Rapids
language.
If you need to include any formatting, then please use Markup language. Although it is up to the client to support it, Markup is one of the simplest and easiest alternatives.
Return null
to indicate that the object should not be
included in the documentation.
description
in class AstPrimitive<AstDistance>
public Val apply(Env env, Env.StackHelp stk, AstRoot[] asts)
AstBuiltin
Primary method to invoke this function, passing all the parameters as the `asts` list.
The default implementation of this method executes all Asts within
the provided environment, and then calls AstBuiltin.exec(Val[])
passing it
the arguments as the list of Val
s. A derived class will then only
need to override the second `exec()` function which is much simpler.
However for certain functions (such as short-circuit boolean operators) executing all arguments is not desirable -- these functions would have to override this more general method.
apply
in class AstBuiltin<AstDistance>
env
- Current execution environment. Variables are looked up here.stk
- TODO need clarificationasts
- List of AstRoot expressions that are arguments to the
function. First element in this list is the function itself.