public class HashTrieMap extends java.lang.Object implements MapItem
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,
GroundedValue<?> value)
Create a new map containing the existing entries in the map plus an additional entry,
without modifying the original.
|
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
|
void |
diagnosticDump() |
GroundedValue<?> |
get(AtomicValue key)
Get an entry from the Map
|
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
|
boolean |
initialPut(AtomicValue key,
GroundedValue<?> value)
Add a new entry to this map.
|
boolean |
isEmpty()
Ask whether the map is empty
|
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
|
HashTrieMap |
remove(AtomicValue key)
Remove an entry from the map
|
static HashTrieMap |
singleton(AtomicValue key,
GroundedValue<?> value)
Create a singleton map with a single key and value
|
int |
size()
Get the size of the map
|
java.lang.String |
toShortString()
Provide a short string showing the contents of the item, suitable
for use in error messages
|
java.lang.String |
toString() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
atomize, call, deepEquals, effectiveBooleanValue, export, getAnnotations, getArity, getDescription, getFunctionItemType, getFunctionName, getGenre, getItemTypeOfSequence, getOperandRoles, getStringValue, getStringValueCS, getTypedValue, isArray, isKnownToConform, isMap, isTrustedResultType, itemAt, makeNewContext, mapToString
argumentArray
getLength, head, isStreamed, iterate, iterator, reduce, subsequence, toGroundedValue
asIterable, materialize
makeRepeatable
public 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, GroundedValue<?> value)
key
- the key valuevalue
- the associated valuepublic static HashTrieMap copy(MapItem map)
map
- the existing map to be copiedpublic int size()
public boolean isEmpty()
public boolean conforms(AtomicType requiredKeyType, SequenceType requiredValueType, TypeHierarchy th)
public MapType getItemType(TypeHierarchy th)
getItemType
in interface MapItem
th
- The type hierarchy cache for the configurationpublic UType getKeyUType()
getKeyUType
in interface MapItem
public HashTrieMap addEntry(AtomicValue key, GroundedValue<?> value)
public boolean initialPut(AtomicValue key, GroundedValue<?> 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 GroundedValue<?> get(AtomicValue key)
public KeyValuePair getKeyValuePair(AtomicValue key)
key
- the value of the keypublic AtomicIterator keys()
public java.lang.Iterable<KeyValuePair> keyValuePairs()
keyValuePairs
in interface MapItem
public void diagnosticDump()
public java.lang.String toShortString()
MapItem
toShortString
in interface MapItem
toShortString
in interface Function
toShortString
in interface GroundedValue<Function>
toShortString
in interface Item<Function>
public java.lang.String toString()
toString
in class java.lang.Object
Copyright (c) 2004-2020 Saxonica Limited. All rights reserved.