Package net.sf.saxon.ma.map
Class DeltaMap
java.lang.Object
net.sf.saxon.ma.MapOrArray
net.sf.saxon.ma.map.MapItem
net.sf.saxon.ma.map.MapWithTypeCache
net.sf.saxon.ma.map.DeltaMap
- All Implemented Interfaces:
Iterable<KeyValuePair>,Callable,FunctionItem,GroundedValue,Item,Sequence
A
DeltaMap consists of a fixed part and a variable part. The fixed part represents
the result of building a map "in bulk", for example with a map:merge or map:build call,
or as the output of JSON parsing. The variable part represents the result of subsequent
map:put and map:remove operations.
The thinking here is that map:put and map:remove operations are
fairly rare, so most maps will be implemented as instances of AbstractFixedMap.
If a map:put or map:remove then occurs, the result will be a DeltaMap
that contains the original AbstractFixedMap, plus details of subsequent changes.
The variable part, representing the differences, actually includes three data structures:
- A list of removals: entries that have been removed from the fixed map
- A list of replacements: entries where a new value is now associated with a key that was present in the fixed map
- A list of additions: new key-value pairs, themselves represented as a map
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class net.sf.saxon.ma.map.MapItem
MapItem.KeyIterator -
Field Summary
Fields inherited from class net.sf.saxon.ma.map.MapWithTypeCache
knownKeyType, knownValueTypeFields inherited from class net.sf.saxon.ma.map.MapItem
mapConstructorDuplicatesAction, xslMapDuplicatesAction, xslRecordDuplicatesAction -
Constructor Summary
ConstructorsConstructorDescriptionDeltaMap(AbstractFixedMap fixedMap) Construct aDeltaMapwith a supplied fixed part, and an empty variable part -
Method Summary
Modifier and TypeMethodDescriptionget(AtomicValue key) Get the value with a given key.iterator()ImplementIterable<KeyValuePair>Get the set of all key-value pairs in the mapput(AtomicValue key, GroundedValue value) Create a new map containing the existing entries in the map plus an additional entry, without modifying the original.remove(AtomicValue key) Remove an entry from the mapintsize()Get the size of the mapMethods inherited from class net.sf.saxon.ma.map.MapWithTypeCache
conforms, setKnownTypeMethods inherited from class net.sf.saxon.ma.map.MapItem
atomize, call, deepEqual40, deepEquals, effectiveBooleanValue, entries, export, followingKeyValuePairs, getAnnotations, getArity, getDescription, getFunctionItemType, getFunctionName, getGenre, getItemType, getItemTypeOfSequence, getOperandRoles, getSpecVersion, getTypedValue, getU, getUnicodeStringValue, getWithPlan, isArray, isEmpty, isKnownToConform, isMap, isTrustedResultType, itemAt, keys, makeNewContext, mapToString, precedingKeyValuePairs, setSpecVersion, toShortStringMethods inherited from class net.sf.saxon.ma.MapOrArray
obtainRootJNodeMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.sf.saxon.om.FunctionItem
isSequenceVariadicMethods inherited from interface net.sf.saxon.om.GroundedValue
asIterable, concatenate, containsNode, materializeMethods inherited from interface net.sf.saxon.om.Item
getLabel, getLength, getStringValue, head, isStreamed, iterate, reduce, subsequenceMethods inherited from interface java.lang.Iterable
forEach, spliteratorMethods inherited from interface net.sf.saxon.om.Sequence
makeRepeatable
-
Constructor Details
-
DeltaMap
Construct aDeltaMapwith a supplied fixed part, and an empty variable part- Parameters:
fixedMap- the supplied fixed part
-
-
Method Details
-
get
Get the value with a given key. This searches first, the additional entries, then the fixed entries, but taking into account any removals and replacements -
size
public int size()Description copied from class:MapItemGet the size of the map -
keyValuePairs
Description copied from class:MapItemGet the set of all key-value pairs in the map- Specified by:
keyValuePairsin classMapItem- Returns:
- an iterable containing all the key-value pairs
-
iterator
ImplementIterable<KeyValuePair>- Specified by:
iteratorin interfaceIterable<KeyValuePair>- Returns:
- an iterator over the key-value pairs
-
put
Description copied from class:MapItemCreate a new map containing the existing entries in the map plus an additional entry, without modifying the original. If there is already an entry with the specified key, this entry is replaced by the new entry. -
remove
Description copied from class:MapItemRemove an entry from the map
-