public class FunctionLibrary<N> extends Object
FunctionSignature
already in the "type" package.
The method #functionTypes()
returns
a function which is a projection to type information only (w/o implementation).BuiltinFunctionSignature
is an easy to use but restricted implmentation,
sufficient for most cases and supported here with additional convenience factory
and call-back methods.eu.bandm.tools.tpath.runtime.BuiltinFunctions
and
eu.bandm.tools.tpath.xslt.BuiltinFunctions
.
---functions()--> NamespaceName->tpath.runtime.Function FunctionLibrary ---functionTypes()--> NamespaceName->FunctionSignature /_\ /_\ | | +------------+-------------+ BuiltinFunctionSignature | | tpath.runtime.BuiltInFunction | ^ | |____addAll()___ xslt.base.BuiltInFunctionsThis solution has been chosen for an easier and more consistent way of definition/maintanance.
Modifier and Type | Field and Description |
---|---|
static Predicate<Type.XPathType> |
asBoolean |
static Predicate<Type.XPathType> |
asNodeSet |
static Predicate<Type.XPathType> |
asNumber |
static Predicate<Type.XPathType> |
asObject |
static Predicate<Type.XPathType> |
asString |
static Type.XPathType |
bool |
protected NodeSet<N> |
emptyNodeSet |
protected Boolean<N> |
FALSE |
Function<NamespaceName,Function<N>> |
functions |
Function<NamespaceName,FunctionSignature> |
functionTypes |
protected Map<NamespaceName,Function<N>> |
map |
protected MessageReceiver<SimpleMessage<XMLDocumentIdentifier>> |
msg |
static Type.XPathType |
number |
static Type.XPathType |
string |
protected Boolean<N> |
TRUE |
Constructor and Description |
---|
FunctionLibrary(MessageReceiver<SimpleMessage<XMLDocumentIdentifier>> msg) |
Modifier and Type | Method and Description |
---|---|
void |
addAll(FunctionLibrary<N> others,
boolean override) |
protected void |
define(FunctionSignature sig,
BiFunction<Context<N>,List<? extends Value<N>>,Value<N>> impl) |
void |
dump(PrintStream p) |
protected void |
error(Location<XMLDocumentIdentifier> loc,
String s) |
protected void |
error(String s) |
protected void |
hint(String s) |
protected void |
log(Location<XMLDocumentIdentifier> loc,
String s) |
protected void |
log(String s) |
protected <N> Value<N> |
node2stringResult(Context<N> c,
N node)
Implements the frequently found convention that non-existing nodes yield an empty string.
|
protected List<String> |
oneOrMoreStrings(DocumentClient<N> dc,
Value<N> value)
Implements the frequently found conversion of a node set to a list of strings.
|
protected static boolean |
P_boolean(List<? extends Value<?>> values,
int pos) |
protected static boolean |
P_exists(List<? extends Value<?>> values,
int pos) |
protected boolean |
P_hasLeadingNodeSet(List<? extends Value<N>> values) |
protected static int |
P_int(List<? extends Value<?>> values,
int pos)
eg.
|
protected N |
P_leadingDocOrderNode(List<? extends Value<N>> values,
int pos) |
protected NodeSet<N> |
P_nodeSet(List<? extends Value<N>> values,
int pos) |
protected static double |
P_number(List<? extends Value<?>> values,
int pos) |
protected static String |
P_string(List<? extends Value<?>> values,
int pos) |
protected <N> Value<N> |
string2stringResult(String s)
Implements the frequently found convention that String=null yield an empty string.
|
protected BuiltinFunctionSignature |
T(String localName,
Type.XPathType range) |
protected void |
warning(Location<XMLDocumentIdentifier> loc,
String s) |
protected void |
warning(String s) |
protected final MessageReceiver<SimpleMessage<XMLDocumentIdentifier>> msg
public static final Type.XPathType number
public static final Type.XPathType string
public static final Type.XPathType bool
public static final Predicate<Type.XPathType> asObject
public static final Predicate<Type.XPathType> asNumber
public static final Predicate<Type.XPathType> asString
public static final Predicate<Type.XPathType> asBoolean
public static final Predicate<Type.XPathType> asNodeSet
protected Map<NamespaceName,Function<N>> map
public final Function<NamespaceName,Function<N>> functions
public final Function<NamespaceName,FunctionSignature> functionTypes
public FunctionLibrary(MessageReceiver<SimpleMessage<XMLDocumentIdentifier>> msg)
protected BuiltinFunctionSignature T(String localName, Type.XPathType range)
protected void define(FunctionSignature sig, BiFunction<Context<N>,List<? extends Value<N>>,Value<N>> impl)
public void addAll(FunctionLibrary<N> others, boolean override)
public void dump(PrintStream p)
protected static int P_int(List<? extends Value<?>> values, int pos)
protected <N> Value<N> node2stringResult(Context<N> c, N node)
protected <N> Value<N> string2stringResult(String s)
protected List<String> oneOrMoreStrings(DocumentClient<N> dc, Value<N> value)
protected void error(Location<XMLDocumentIdentifier> loc, String s)
protected void log(Location<XMLDocumentIdentifier> loc, String s)
protected void warning(Location<XMLDocumentIdentifier> loc, String s)
protected void error(String s)
protected void log(String s)
protected void warning(String s)
protected void hint(String s)
see also the complete user documentation .