Class DelegatingMapItem

java.lang.Object
net.sf.saxon.ma.map.MapItem
com.saxonica.xsltextn.pedigree.DelegatingMapItem
All Implemented Interfaces:
Callable, FunctionItem, GroundedValue, Item, Sequence
Direct Known Subclasses:
PedigreeMapItem

public abstract class DelegatingMapItem extends MapItem
A DelegatingMapItem is an abstract class representing a map that is implemented by delegating all map-related functionality to another map. Unless any methods are overridden, the functionality is identical to that of the wrapped map item.

Note that methods such as addEntry(net.sf.saxon.value.AtomicValue, net.sf.saxon.om.GroundedValue) that create a new map will (unless overridden) simply delegate to the base map, and the new map will therefore not be a delegating map.

  • Constructor Details

    • DelegatingMapItem

      public DelegatingMapItem(MapItem base)
      Create a DelegatingMapItem that delegates all map-related access to a specified base map.
      Parameters:
      base - the map item to which this implementation delegates
  • Method Details

    • get

      public GroundedValue get(AtomicValue key)
      Description copied from class: MapItem
      Get an entry from the Map
      Specified by:
      get in class MapItem
      Parameters:
      key - the value of the key
      Returns:
      the value associated with the given key, or null if the key is not present in the map.
    • size

      public int size()
      Description copied from class: MapItem
      Get the size of the map
      Specified by:
      size in class MapItem
      Returns:
      the number of keys/entries present in this map
    • isEmpty

      public boolean isEmpty()
      Description copied from class: MapItem
      Ask whether the map is empty
      Overrides:
      isEmpty in class MapItem
      Returns:
      true if and only if the size of the map is zero
    • keys

      public AtomicIterator keys()
      Description copied from class: MapItem
      Get the set of all key values in the map.
      Specified by:
      keys in class MapItem
      Returns:
      a set containing all the key values present in the map, in unpredictable order
    • keyValuePairs

      public Iterable<KeyValuePair> keyValuePairs()
      Description copied from class: MapItem
      Get the set of all key-value pairs in the map
      Specified by:
      keyValuePairs in class MapItem
      Returns:
      an iterable containing all the key-value pairs
    • addEntry

      public MapItem addEntry(AtomicValue key, GroundedValue value)
      Description copied from class: MapItem
      Create 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.
      Specified by:
      addEntry in class MapItem
      Parameters:
      key - the key of the new entry
      value - the value associated with the new entry
      Returns:
      the new map containing the additional entry
    • remove

      public MapItem remove(AtomicValue key)
      Description copied from class: MapItem
      Remove an entry from the map
      Specified by:
      remove in class MapItem
      Parameters:
      key - the key of the entry to be removed
      Returns:
      a new map in which the requested entry has been removed; or this map unchanged if the specified key was not present
    • conforms

      public boolean conforms(PlainType keyType, SequenceType valueType, TypeHierarchy th)
      Description copied from class: MapItem
      Ask whether the map conforms to a given map type
      Specified by:
      conforms in class MapItem
      Parameters:
      keyType - the required keyType
      valueType - the required valueType
      th - the type hierarchy cache for the configuration
      Returns:
      true if the map conforms to the required type
    • getItemType

      public MapType getItemType(TypeHierarchy th)
      Description copied from class: MapItem
      Get the type of the map. This method is used largely for diagnostics, to report the type of a map when it differs from the required type.
      Specified by:
      getItemType in class MapItem
      Parameters:
      th - the type hierarchy cache
      Returns:
      the type of this map
    • getKeyUType

      public UType getKeyUType()
      Description copied from class: MapItem
      Get the lowest common item type of the keys in the map
      Specified by:
      getKeyUType in class MapItem
      Returns:
      the most specific type to which all the keys belong. If the map is empty, return UType.VOID
    • getBaseItem

      public MapItem getBaseItem()
    • toString

      public String toString()
      Overrides:
      toString in class Object