com.saxonica.functions.map
Interface MapItem

All Superinterfaces:
FunctionItem<MapItem>, Item<MapItem>, PullEvent, ValueRepresentation<MapItem>
All Known Implementing Classes:
ImmutableMap, SingletonMap

public interface MapItem
extends FunctionItem<MapItem>, Item<MapItem>, ValueRepresentation<MapItem>

Interface supported by different implementations of an XDM map item


Field Summary
 
Fields inherited from interface net.sf.saxon.om.ValueRepresentation
EMPTY_VALUE_ARRAY
 
Method Summary
 ValueRepresentation<? extends Item> get(AtomicValue key, XPathContext context)
          Get an entry from the Map
 StringCollator getCollation()
          Get the collation of the map
 String getCollationName()
          Get the name of the collation of the map
 AtomicType getKeyType(TypeHierarchy th)
          Get the lowest common item type of the keys in the map
 SequenceType getValueType(TypeHierarchy th)
          Get the lowest common sequence type of all the values in the map
 boolean isEmpty()
          Ask whether the map is empty
 UnfailingIterator<AtomicValue> keys()
          Get the set of all key values in the map.
 MapItem remove(AtomicValue key, XPathContext context)
          Remove an entry from the map
 int size()
          Get the size of the map
 
Methods inherited from interface net.sf.saxon.om.FunctionItem
curry, deepEquals, getArity, getFunctionItemType, getFunctionName, invoke
 
Methods inherited from interface net.sf.saxon.om.Item
getStringValue, getStringValueCS, getTypedValue
 

Method Detail

getCollationName

String getCollationName()
Get the name of the collation of the map

Returns:
the collation name

getCollation

StringCollator getCollation()
Get the collation of the map

Returns:
the collation of the map

get

ValueRepresentation<? extends Item> get(AtomicValue key,
                                        XPathContext context)
                                        throws XPathException
Get an entry from the Map

Parameters:
key - the value of the key
context - the XPath dynamic evaluation context
Returns:
the value associated with the given key, or null if the key is not present in the map
Throws:
XPathException - if a dynamic error occurs

size

int size()
Get the size of the map

Returns:
the number of keys/entries present in this map

isEmpty

boolean isEmpty()
Ask whether the map is empty

Returns:
true if and only if the size of the map is zero

keys

UnfailingIterator<AtomicValue> keys()
Get the set of all key values in the map.

Returns:
a set containing all the key values present in the map.

remove

MapItem remove(AtomicValue key,
               XPathContext context)
               throws XPathException
Remove an entry from the map

Parameters:
key - the key of the entry to be removed
context - the XPath dynamic context
Returns:
a new map in which the requested entry has been removed; or this map unchanged if the specified key was not present
Throws:
XPathException - if a dynamic error occurs

getKeyType

AtomicType getKeyType(TypeHierarchy th)
Get the lowest common item type of the keys in the map

Parameters:
th - the type hierarchy
Returns:
the most specific type to which all the keys belong. If the map is empty, return AnyAtomicType by convention

getValueType

SequenceType getValueType(TypeHierarchy th)
Get the lowest common sequence type of all the values in the map

Parameters:
th - the type hierarchy
Returns:
the most specific sequence type to which all the values belong. If the map is empty, return ANY_SEQUENCE by convention


Copyright (c) 2004-2011 Saxonica Limited. All rights reserved.