Package eu.bandm.tools.tpath.runtime
Class FunctionLibrary<N>
java.lang.Object
eu.bandm.tools.tpath.runtime.FunctionLibrary<N>
- Type Parameters:
N
- the node type from which node set expressions are built. With built-in JAXP DOM, it is "org.w3c.dom.Node"
- Direct Known Subclasses:
BuiltInFunctions
,BuiltInFunctions
Infra-Structure for defining xpath functions, built-in as well as extensions.
Includes methods for manipulating the function directory, plus
call-back auxiliary functions for the type signature construction and check.
The data contained here plays a double role: it is needed for runtime execution, but also already in an earlier phase for type checking. This is possible by defining
Examples are
FIXME type constant for "nodeset" result type !??!
The data contained here plays a double role: it is needed for runtime execution, but also already in an earlier phase for type checking. This is possible by defining
FunctionSignature
already in the "type" package.
The field functionTypes
holds
a function which is a projection to type information only (w/o implementation).BuiltinFunctionSignature
is an easy to use but restricted implementation,
sufficient for most cases and supported here with additional convenience factory
and call-back methods.Examples are
BuiltInFunctions
and
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.
FIXME type constant for "nodeset" result type !??!
-
Field Summary
Modifier and TypeFieldDescriptionstatic final Predicate<Type.XPathType>
static final Predicate<Type.XPathType>
static final Predicate<Type.XPathType>
static final Predicate<Type.XPathType>
static final Predicate<Type.XPathType>
static final Type.XPathType
final Function<NamespaceName,
Function<N>> protected Map<NamespaceName,
Function<N>> protected final MessageReceiver<SimpleMessage<XMLDocumentIdentifier>>
static final Type.XPathType
static final Type.XPathType
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
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
protected void
protected void
log
(Location<XMLDocumentIdentifier> loc, String s) protected void
protected <N> Value<N>
node2stringResult
(Context<N> c, N node) Implements the frequently found convention that non-existing nodes yield an empty 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
protected static boolean
protected boolean
P_hasLeadingNodeSet
(List<? extends Value<N>> values) protected static int
eg.protected N
P_leadingDocOrderNode
(List<? extends Value<N>> values, int pos) protected static double
protected static String
protected <N> Value<N>
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
-
Field Details
-
msg
-
number
-
string
-
bool
-
asObject
-
asNumber
-
asString
-
asBoolean
-
asNodeSet
-
map
-
functions
-
functionTypes
-
emptyNodeSet
-
TRUE
-
FALSE
-
-
Constructor Details
-
FunctionLibrary
-
-
Method Details
-
T
-
define
protected void define(FunctionSignature sig, BiFunction<Context<N>, List<? extends Value<N>>, Value<N>> impl) -
addAll
-
dump
-
P_exists
-
P_hasLeadingNodeSet
-
P_boolean
-
P_string
-
P_number
-
P_int
eg. for substring: " rounding is done as if by a call to the round function. " -
P_nodeSet
-
P_leadingDocOrderNode
-
node2stringResult
Implements the frequently found convention that non-existing nodes yield an empty string. -
string2stringResult
Implements the frequently found convention that String=null yield an empty string. -
oneOrMoreStrings
Implements the frequently found conversion of a node set to a list of strings. -
error
-
log
-
warning
-
error
-
log
-
warning
-
hint
-