Class FixedMapWithStringKeys

All Implemented Interfaces:
Iterable<KeyValuePair>, Callable, FunctionItem, GroundedValue, Item, Sequence

public class FixedMapWithStringKeys extends AbstractFixedMap
A variant of the FixedMap map implementation optimized for the case where the keys are all instances of xs:string. This saves space because it avoids the need (a) to wrap the UnicodeString values in a StringValue, and (b) to store a type annotation (as this is always xs:string
  • Constructor Details

    • FixedMapWithStringKeys

      protected FixedMapWithStringKeys(UnicodeString[] keys, GroundedValue[] values, int specVersion, HashMap<AtomicMatchKey,Integer> index)
      Construct a FixedMap supplying the entries as an array of keys and a corresponding array of value. The caller is responsible for ensuring that there are no duplicate keys. The two arrays (of keys and values) must have the same length. The content of the arrays must not be subsequently modified.
      Parameters:
      keys - an array of keys
      values - a corresponding array of values
      index - a hash map indexing the values
  • Method Details

    • getKey

      protected AtomicValue getKey(int position)
      Description copied from class: AbstractFixedMap
      Get the key at a given offset. This method is provided for use by subclasses, which can store the actual key in different ways.
      Specified by:
      getKey in class AbstractFixedMap
      Parameters:
      position - the offset (sibling position within the ordered map) of the required key
      Returns:
      the key at the specified position
    • fromJavaMap

      public static FixedMapWithStringKeys fromJavaMap(Map<UnicodeString,GroundedValue> map)
    • getU

      public GroundedValue getU(UnicodeString key)
      Get an entry from the map, supplying a UnicodeString as the key
      Overrides:
      getU in class MapItem
      Parameters:
      key - the key
      Returns:
      the relevant entry if present, or null if absent.