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.BuiltInFunctions      
  
  This solution has been
  chosen for an easier and more consistent way of definition/maintanance.
  FIXME type constant for "nodeset" result type !??!
- 
Field Summary
FieldsModifier 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.XPathTypefinal Function<NamespaceName, Function<N>> protected Map<NamespaceName, Function<N>> protected final MessageReceiver<SimpleMessage<XMLDocumentIdentifier>> static final Type.XPathTypestatic final Type.XPathType - 
Constructor Summary
Constructors - 
Method Summary
Modifier and TypeMethodDescriptionvoidaddAll(FunctionLibrary<N> others, boolean override) protected voiddefine(FunctionSignature sig, BiFunction<Context<N>, List<? extends Value<N>>, Value<N>> impl) voiddump(PrintStream p) protected voiderror(Location<XMLDocumentIdentifier> loc, String s, Object... args) protected voidprotected voidprotected voidlog(Location<XMLDocumentIdentifier> loc, String s, Object... args) protected voidprotected <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 booleanprotected static booleanprotected booleanP_hasLeadingNodeSet(List<? extends Value<N>> values) protected static integ.protected NP_leadingDocOrderNode(List<? extends Value<N>> values, int pos) protected static doubleprotected static Stringprotected <N> Value<N> Implements the frequently found convention that String=null yield an empty string.protected BuiltinFunctionSignatureT(String localName, Type.XPathType range) protected voidwarning(Location<XMLDocumentIdentifier> loc, String s, Object... args) 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
 
 -