public class HashTrieMap extends AbstractItem implements MapItem, GroundedValue
| Modifier and Type | Field and Description |
|---|---|
static SequenceType |
SINGLE_MAP_TYPE |
| Constructor and Description |
|---|
HashTrieMap()
Create an empty map
|
HashTrieMap(ImmutableMap<AtomicMatchKey,KeyValuePair> imap)
Create a map whose contents are a copy of an existing immutable map
|
| Modifier and Type | Method and Description |
|---|---|
HashTrieMap |
addEntry(AtomicValue key,
Sequence value)
Create a new map containing the existing entries in the map plus an additional entry,
without modifying the original.
|
TupleItemType |
asTupleType(TypeHierarchy th) |
AtomicSequence |
atomize()
Atomize the item.
|
Sequence |
call(XPathContext context,
Sequence[] args)
Invoke the function
|
boolean |
conforms(AtomicType requiredKeyType,
SequenceType requiredValueType,
TypeHierarchy th)
Ask whether the map conforms to a given map type
|
static HashTrieMap |
copy(MapItem map)
Create a map whose entries are copies of the entries in an existing MapItem
|
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
|
void |
diagnosticDump() |
boolean |
effectiveBooleanValue()
Get the effective boolean value of this sequence
|
void |
export(ExpressionPresenter out)
Output information about this function item to the diagnostic explain() output
|
Sequence |
get(AtomicValue key)
Get an entry from the Map
|
AnnotationList |
getAnnotations()
Get the function annotations (as defined in XQuery).
|
int |
getArity()
Get the arity of the function
|
java.lang.String |
getDescription()
Get a description of this function for use in error messages.
|
FunctionItemType |
getFunctionItemType()
Get the item type of this item as a function item.
|
StructuredQName |
getFunctionName()
Get the name of the function, or null if it is anonymous
|
MapType |
getItemType(TypeHierarchy th)
Get the type of the map.
|
UType |
getKeyUType()
Get the lowest common item type of the keys in the map
|
KeyValuePair |
getKeyValuePair(AtomicValue key)
Get an key/value pair from the Map
|
OperandRole[] |
getOperandRoles()
Get the roles of the arguments, for the purposes of streaming
|
java.lang.String |
getStringValue()
Get the value of the item as a string.
|
java.lang.CharSequence |
getStringValueCS()
Get the string value of the item as a CharSequence.
|
SequenceIterator |
getTypedValue()
Get the typed value of the item.
|
boolean |
initialPut(AtomicValue key,
Sequence value)
Add a new entry to this map.
|
boolean |
isArray()
Ask whether this function item is an array
|
boolean |
isEmpty()
Ask whether the map is empty
|
boolean |
isMap()
Ask whether this function item is a map
|
boolean |
isTrustedResultType()
Check that result type is of the trusted system functions to return a result of the correct type
|
MapItem |
itemAt(int n)
Get the n'th item in the value, counting from 0
|
java.util.Iterator<KeyValuePair> |
iterator()
Get the set of all key-value pairs in the map
|
AtomicIterator |
keys()
Get the set of all key values in the map
|
XPathContext |
makeNewContext(XPathContext callingContext)
Prepare an XPathContext object for evaluating the function
|
HashTrieMap |
remove(AtomicValue key)
Remove an entry from the map
|
static HashTrieMap |
singleton(AtomicValue key,
Sequence value,
XPathContext context)
Create a singleton map with a single key and value
|
int |
size()
Get the size of the map
|
java.lang.String |
toString()
Returns a string representation of the object.
|
getLength, head, isStreamed, iterate, reduce, subsequenceclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetLength, head, reduce, subsequencepublic static final SequenceType SINGLE_MAP_TYPE
public HashTrieMap()
public HashTrieMap(ImmutableMap<AtomicMatchKey,KeyValuePair> imap)
imap - the map to be copiedpublic static HashTrieMap singleton(AtomicValue key, Sequence value, XPathContext context) throws XPathException
key - the key valuevalue - the associated valuecontext - dynamic evaluation context. Gives access to type information.XPathException - if map mixes timezoned and timezoneless valuespublic static HashTrieMap copy(MapItem map)
map - the existing map to be copiedpublic boolean isArray()
public boolean isMap()
public AnnotationList getAnnotations()
getAnnotations in interface Functionpublic AtomicSequence atomize() throws XPathException
atomize in interface ItemXPathException - if atomization is not allowed for this kind of itempublic int size()
public boolean isEmpty()
public boolean conforms(AtomicType requiredKeyType, SequenceType requiredValueType, TypeHierarchy th)
public MapType getItemType(TypeHierarchy th)
getItemType in interface MapItemth - The type hierarchy cache for the configurationpublic UType getKeyUType()
getKeyUType in interface MapItempublic OperandRole[] getOperandRoles()
getOperandRoles in interface Functionpublic HashTrieMap addEntry(AtomicValue key, Sequence value)
public boolean initialPut(AtomicValue key, Sequence value)
key - the key of the new entry. Any existing entry with this key is replaced.value - the value associated with the new entrypublic HashTrieMap remove(AtomicValue key)
public Sequence get(AtomicValue key)
public KeyValuePair getKeyValuePair(AtomicValue key)
key - the value of the keypublic AtomicIterator keys()
public java.util.Iterator<KeyValuePair> iterator()
iterator in interface java.lang.Iterable<KeyValuePair>iterator in interface MapItempublic FunctionItemType getFunctionItemType()
getFunctionItemType in interface Functionpublic StructuredQName getFunctionName()
getFunctionName in interface Functionpublic java.lang.String getDescription()
getDescription in interface Functionpublic int getArity()
public XPathContext makeNewContext(XPathContext callingContext)
makeNewContext in interface FunctioncallingContext - the XPathContext of the function calling expressionpublic Sequence call(XPathContext context, Sequence[] args) throws XPathException
call in interface Callablecall in interface Functioncontext - the XPath dynamic evaluation contextargs - the actual arguments to be suppliedXPathException - if an error occurs evaluating
the supplied argumentpublic java.lang.String getStringValue()
getStringValueCS() should
be used. If the caller requires a string, this method is preferred.getStringValue in interface GroundedValuegetStringValue in interface Itemjava.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()public 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 GroundedValuegetStringValueCS in interface Itemjava.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()public SequenceIterator getTypedValue() throws XPathException
XPathException - where no typed value is available, for example in the case of
an element with complex contentpublic boolean deepEquals(Function other, XPathContext context, AtomicComparer comparer, int flags) throws XPathException
deepEquals in interface Functionother - 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 performedpublic MapItem itemAt(int n)
AbstractItemitemAt in interface GroundedValueitemAt in class AbstractItemn - the index of the required item, with 0 representing the first item in the sequencepublic boolean effectiveBooleanValue()
throws XPathException
GroundedValueeffectiveBooleanValue in interface GroundedValueXPathException - if the sequence has no effective boolean value (for example a sequence of two integers)public TupleItemType asTupleType(TypeHierarchy th)
public java.lang.String toString()
toString in class java.lang.Objectpublic void export(ExpressionPresenter out) throws XPathException
export in interface FunctionXPathExceptionpublic boolean isTrustedResultType()
FunctionisTrustedResultType in interface Functionpublic void diagnosticDump()
Copyright (c) 2004-2018 Saxonica Limited. All rights reserved.