Saxon.Api
Class XdmMap
-
public class XdmMap
- extends XdmFunctionItem
The class XdmMap
represents a map item in an XPath 3.1 sequence:
this is a new kind of item in the XDM data model. A map is a list of zero or more
entries, each of which
is a pair comprising a key (which is an atomic value) and a value (which is an arbitrary
value).
Constructor Summary |
|
---|---|
XdmMap ()
Create an empty |
Property Summary |
|
---|---|
int | Size Get the number of entries in the map |
Method Summary |
|
---|---|
Dictionary<XdmAtomicValue, XdmValue> | AsDictionary () Return a corresponding .NET Dictionary collection of keys and values. |
bool | ContainsKey (XdmAtomicValue key)
Returns |
HashSet<DictionaryEntry> | EntrySet ()
Returns a |
XdmValue | Get (XdmAtomicValue key)
Returns the value to which the specified key is mapped,
or |
XdmValue | Get (string key)
Returns the value to which the specified key is mapped,
or |
XdmValue | Get (long key)
Returns the value to which the specified key is mapped,
or |
bool | IsEmpty ()
Ask whether the |
HashSet<XdmAtomicValue> | KeySet () Get the keys present in the map in the form of a set. |
static XdmMap | MakeMap (IDictionary input)
Static factory method to construct an XDM map by converting each entry
in a supplied generic collection of key/value pairs; |
XdmMap | Put (XdmAtomicValue key, XdmValue value) Create a new map containing an additional (key, value) pair. If there is an existing entry with the same key, it is removed. |
XdmMap | Remove (XdmAtomicValue key) Create a new map in which the entry for a given key has been removed. If there is no entry with the same key, the new map has the same content as the old (it may or may not be the same .NET object) |
ICollection<XdmValue> | Values ()
Returns a |
Property Detail
Size
Get the number of entries in the map
(Note that the XdmValue.Count method returns 1 (one), because an XDM map is an item.)
Method Detail
AsDictionary
ContainsKey
Returns true
if this map contains a mapping for the specified
key. More formally, returns true
if and only if
this map contains a mapping for a key k
such that
(key==null ? k==null : key.Equals(k))
. (There can be
at most one such mapping.)
Parameters:
key
- the key whose presence in this map is to be testedReturns:
true
if this map contains a mapping for the specified keyEntrySet
Returns a HashSet
view of the mappings contained in this map.
Returns:
Get
Returns the value to which the specified key is mapped,
or null
if this map contains no mapping for the key.
Parameters:
key
- the key whose associated value is to be returned. If this is
not an XdmAtomicValue
, the method attempts to construct an
XdmAtomicValue
using the method XdmAtomicValue.MakeAtomicValue(Object);
it is therefore possible to pass a simple key such as a string or integer.Returns:
null
if this map contains no mapping for the keyGet
Returns the value to which the specified key is mapped,
or null
if this map contains no mapping for the key.
Parameters:
key
- the key whose associated value is to be returned.Returns:
null
if this map contains no mapping for the keyGet
Returns the value to which the specified key is mapped,
or null
if this map contains no mapping for the key.
Parameters:
key
- the key whose associated value is to be returned.Returns:
null
if this map contains no mapping for the keyIsEmpty
Ask whether the XdmMap
is empty
Returns:
true
if this map contains no key-value pairs, that is
if the Size
property is zero.KeySet
Get the keys present in the map in the form of a set.
Returns:
MakeMap
Static factory method to construct an XDM map by converting each entry
in a supplied generic collection of key/value pairs; IDictionary
. The keys in the
Dictionary must be convertible to XDM atomic values using the
XdmAtomicValue.MakeAtomicValue(Object) method. The associated values
must be convertible to XDM sequences
using the XdmValue.MakeValue(Object) method.
Parameters:
input
- the supplied mapReturns:
XdmMap
Put
XdmValue value)
Create a new map containing an additional (key, value) pair. If there is an existing entry with the same key, it is removed.
Parameters:
key
- The key of the new entry.value
- The value part of the new entry.Returns:
Remove
Create a new map in which the entry for a given key has been removed. If there is no entry with the same key, the new map has the same content as the old (it may or may not be the same .NET object)
Parameters:
key
- The key of the entry that is to be removedReturns:
Values
Returns a Collection
containing the values found in this map.
Returns:
Return a corresponding .NET Dictionary collection of keys and values.
Returns: