public interface MapItem extends Function<MapItem>
| Modifier and Type | Method and Description |
|---|---|
MapItem |
addEntry(AtomicValue key,
GroundedValue<? extends Item> value)
Create a new map containing the existing entries in the map plus an additional entry,
without modifying the original.
|
default AtomicSequence |
atomize()
Atomize the item.
|
default Sequence |
call(XPathContext context,
Sequence[] args)
Invoke the function
|
boolean |
conforms(AtomicType keyType,
SequenceType valueType,
TypeHierarchy th)
Ask whether the map conforms to a given map type
|
default boolean |
deepEquals(Function other,
XPathContext context,
AtomicComparer comparer,
int flags)
Test whether this FunctionItem is deep-equal to another function item,
under the rules of the deep-equal function
|
default boolean |
effectiveBooleanValue()
Get the effective boolean value of this sequence
|
default void |
export(ExpressionPresenter out)
Output information about this function item to the diagnostic explain() output
|
GroundedValue<? extends Item> |
get(AtomicValue key)
Get an entry from the Map
|
default AnnotationList |
getAnnotations()
Get the function annotations (as defined in XQuery).
|
default int |
getArity()
Get the arity of the function
|
default java.lang.String |
getDescription()
Get a description of this function for use in error messages.
|
default FunctionItemType |
getFunctionItemType()
Get the item type of this item as a function item.
|
default StructuredQName |
getFunctionName()
Get the name of the function, or null if it is anonymous
|
default Genre |
getGenre()
Get the genre of this item
|
ItemType |
getItemType(TypeHierarchy th)
Get the type of the map.
|
static ItemType |
getItemTypeOfSequence(Sequence val)
Get an item type to which all the values in a sequence are known to conform
|
UType |
getKeyUType()
Get the lowest common item type of the keys in the map
|
default OperandRole[] |
getOperandRoles()
Get the roles of the arguments, for the purposes of streaming
|
default java.lang.String |
getStringValue()
Get the value of the item as a string.
|
default java.lang.CharSequence |
getStringValueCS()
Get the string value of the item as a CharSequence.
|
default SequenceIterator |
getTypedValue()
Get the typed value of the item.
|
default boolean |
isArray()
Ask whether this function item is an array
|
boolean |
isEmpty()
Ask whether the map is empty
|
static boolean |
isKnownToConform(Sequence value,
ItemType itemType)
Ask whether all the items in a sequence are known to conform to a given item type
|
default boolean |
isMap()
Ask whether this function item is a map
|
default boolean |
isTrustedResultType()
Check that result type is of the trusted system functions to return a result of the correct type
|
default MapItem |
itemAt(int n)
Get the n'th item in the value, counting from 0
|
AtomicIterator |
keys()
Get the set of all key values in the map.
|
java.lang.Iterable<KeyValuePair> |
keyValuePairs()
Get the set of all key-value pairs in the map
|
default XPathContext |
makeNewContext(XPathContext callingContext)
Prepare an XPathContext object for evaluating the function
|
static java.lang.String |
mapToString(MapItem map)
Returns a string representation of the object.
|
MapItem |
remove(AtomicValue key)
Remove an entry from the map
|
int |
size()
Get the size of the map
|
default java.lang.String |
toShortString()
Provide a short string showing the contents of the item, suitable
for use in error messages
|
argumentArrayasArgumentArray, getLength, head, isStreamed, iterate, iterator, reduce, subsequenceasIterable, materializemakeRepeatableGroundedValue<? extends Item> get(AtomicValue key)
key - the value of the keyint size()
boolean isEmpty()
AtomicIterator keys()
java.lang.Iterable<KeyValuePair> keyValuePairs()
MapItem addEntry(AtomicValue key, GroundedValue<? extends Item> value)
key - the key of the new entryvalue - the value associated with the new entryMapItem remove(AtomicValue key)
key - the key of the entry to be removedboolean conforms(AtomicType keyType, SequenceType valueType, TypeHierarchy th)
keyType - the required keyTypevalueType - the required valueTypeth - the type hierarchy cache for the configurationItemType getItemType(TypeHierarchy th)
UType getKeyUType()
default java.lang.String toShortString()
toShortString in interface Function<MapItem>toShortString in interface GroundedValue<MapItem>toShortString in interface Item<MapItem>default Genre getGenre()
default boolean isArray()
default boolean isMap()
default AnnotationList getAnnotations()
getAnnotations in interface Function<MapItem>default AtomicSequence atomize() throws XPathException
atomize in interface Item<MapItem>XPathException - if atomization is not allowed for this kind of itemstatic boolean isKnownToConform(Sequence value, ItemType itemType)
value - the sequenceitemType - the given item typestatic ItemType getItemTypeOfSequence(Sequence val)
val - the sequencedefault OperandRole[] getOperandRoles()
getOperandRoles in interface Function<MapItem>default FunctionItemType getFunctionItemType()
getFunctionItemType in interface Function<MapItem>default StructuredQName getFunctionName()
getFunctionName in interface Function<MapItem>default java.lang.String getDescription()
getDescription in interface Function<MapItem>default int getArity()
default XPathContext makeNewContext(XPathContext callingContext)
makeNewContext in interface Function<MapItem>callingContext - the XPathContext of the function calling expressiondefault Sequence call(XPathContext context, Sequence[] args) throws XPathException
call in interface Callablecall in interface Function<MapItem>context - the XPath dynamic evaluation contextargs - the actual arguments to be suppliedXPathException - if an error occurs evaluating
the supplied argumentdefault java.lang.String getStringValue()
If the calling code can handle any CharSequence, the method getStringValueCS() should
be used. If the caller requires a string, this method is preferred.
getStringValue in interface GroundedValue<MapItem>getStringValue in interface Item<MapItem>java.lang.UnsupportedOperationException - if the item is a function item (an unchecked exception
is used here to avoid introducing exception handling to a large number of paths where it is not
needed)getStringValueCS()default java.lang.CharSequence getStringValueCS()
X.getStringValueCS().toString() returns a string that is equal to
X.getStringValue().
Note that two CharSequence values of different types should not be compared using equals(), and for the same reason they should not be used as a key in a hash table.
If the calling code can handle any CharSequence, this method should
be used. If the caller requires a string, the getStringValue() method is preferred.
getStringValueCS in interface GroundedValue<MapItem>getStringValueCS in interface Item<MapItem>java.lang.UnsupportedOperationException - if the item is a function item (an unchecked exception
is used here to avoid introducing exception handling to a large number of paths where it is not
needed)getStringValue()default SequenceIterator getTypedValue() throws XPathException
For a node, this is the typed value as defined in the XPath 2.0 data model. Since a node may have a list-valued data type, the typed value is in general a sequence, and it is returned in the form of a SequenceIterator.
If the node has not been validated against a schema, the typed value will be the same as the string value, either as an instance of xs:string or as an instance of xs:untypedAtomic, depending on the node kind.
For an atomic value, this method returns an iterator over a singleton sequence containing the atomic value itself.
XPathException - where no typed value is available, for example in the case of
an element with complex contentdefault boolean deepEquals(Function other, XPathContext context, AtomicComparer comparer, int flags) throws XPathException
deepEquals in interface Function<MapItem>other - the other function itemcontext - the dynamic evaluation contextcomparer - the object to perform the comparisonflags - options for how the comparison is performedXPathException - if the comparison cannot be performeddefault MapItem itemAt(int n)
Itemdefault boolean effectiveBooleanValue()
throws XPathException
GroundedValueeffectiveBooleanValue in interface GroundedValue<MapItem>XPathException - if the sequence has no effective boolean value (for example a sequence of two integers)static java.lang.String mapToString(MapItem map)
default void export(ExpressionPresenter out) throws XPathException
export in interface Function<MapItem>XPathExceptiondefault boolean isTrustedResultType()
FunctionisTrustedResultType in interface Function<MapItem>Copyright (c) 2004-2018 Saxonica Limited. All rights reserved.