public class DictionaryMap extends MapItem
Constructor and Description |
---|
DictionaryMap()
Create an empty dictionary, to which entries can be added using
initialPut(String, GroundedValue) ,
provided this is done before the map is exposed to the outside world. |
DictionaryMap(int size)
Create an empty dictionary, to which entries can be added using
initialPut(String, GroundedValue) ,
provided this is done before the map is exposed to the outside world. |
Modifier and Type | Method and Description |
---|---|
MapItem |
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 keyType,
SequenceType valueType,
TypeHierarchy th)
Ask whether the map conforms to a given map type
|
GroundedValue |
get(AtomicValue key)
Get an entry from the Map
|
ItemType |
getItemType(TypeHierarchy th)
Get the type of the map.
|
UType |
getKeyUType()
Get the lowest common item type of the keys in the map
|
void |
initialAppend(java.lang.String key,
GroundedValue value)
During initial construction of the map, append a value to a possibly existing key-value pair
|
void |
initialPut(java.lang.String key,
GroundedValue value)
During initial construction of the map, add a key-value pair
|
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
|
MapItem |
remove(AtomicValue key)
Remove an entry from the map
|
int |
size()
Get the size of the map
|
atomize, call, deepEquals, effectiveBooleanValue, export, getAnnotations, getArity, getDescription, getFunctionItemType, getFunctionName, getGenre, getItemTypeOfSequence, getOperandRoles, getTypedValue, getUnicodeStringValue, isArray, isKnownToConform, isMap, isTrustedResultType, itemAt, makeNewContext, mapToString, toShortString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
isSequenceVariadic
getLength, getStringValue, head, isStreamed, iterate, reduce, subsequence
asIterable, concatenate, containsNode, materialize
makeRepeatable
public DictionaryMap()
initialPut(String, GroundedValue)
,
provided this is done before the map is exposed to the outside world.public DictionaryMap(int size)
initialPut(String, GroundedValue)
,
provided this is done before the map is exposed to the outside world.size
- estimated final size of the dictionarypublic void initialPut(java.lang.String key, GroundedValue value)
key
- the keyvalue
- the corresponding valuepublic void initialAppend(java.lang.String key, GroundedValue value)
key
- the keyvalue
- the corresponding valuepublic GroundedValue get(AtomicValue key)
public int size()
public boolean isEmpty()
public AtomicIterator keys()
public java.lang.Iterable<KeyValuePair> keyValuePairs()
keyValuePairs
in class MapItem
public MapItem addEntry(AtomicValue key, GroundedValue value)
public MapItem remove(AtomicValue key)
public boolean conforms(AtomicType keyType, SequenceType valueType, TypeHierarchy th)
public ItemType getItemType(TypeHierarchy th)
getItemType
in class MapItem
th
- the type hierarchy cachepublic UType getKeyUType()
getKeyUType
in class MapItem
Copyright (c) 2004-2022 Saxonica Limited. All rights reserved.