Class RangeKey

  • All Implemented Interfaces:
    Callable, FunctionItem, GroundedValue, Item, Sequence

    public class RangeKey
    extends MapItem
    This class implements an XPath map item as a view of an XSLT key index. It is possible to specify a minimum and maximum key value to be included in the map, and keys are returned in sorted order.

    At present range keys are only available for string-valued keys using the Unicode codepoint collating sequence.

    • Method Detail

      • get

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

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

        public boolean isEmpty()
        Ask whether the map is empty
        isEmpty in class MapItem
        true if and only if the size of the map is zero
      • keys

        public AtomicIterator keys()
        Get the set of all key values in the map.
        Specified by:
        keys in class MapItem
        a set containing all the key values present in the map.
      • keyValuePairs

        public java.lang.Iterable<KeyValuePair> keyValuePairs()
        Get the set of all key-value pairs in the map
        Specified by:
        keyValuePairs in class MapItem
        an iterator over the key-value pairs
      • remove

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

        public UType getKeyUType()
        Get the lowest common item type of the keys in the map
        Specified by:
        getKeyUType in class MapItem
        the most specific type to which all the keys belong. If the map is empty, return ErrorType.getInstance() (the type with no instances)
      • addEntry

        public 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. If there is already an entry with the specified key, this entry is replaced by the new entry.
        Specified by:
        addEntry in class MapItem
        key - the key of the new entry
        value - the value associated with the new entry
        the new map containing the additional entry
      • conforms

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

        public MapType getItemType​(TypeHierarchy th)
        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
        th - the type hierarchy (not used)
        the type of this map
      • getDescription

        public java.lang.String getDescription()
        Get a description of this function for use in error messages. For named functions, the description is the function name (as a lexical QName). For others, it might be, for example, "inline function", or "partially-applied ends-with function".
        Specified by:
        getDescription in interface FunctionItem
        getDescription in class MapItem
        a description of the function for use in error messages
      • deepEquals

        public boolean deepEquals​(FunctionItem other,
                                  XPathContext context,
                                  AtomicComparer comparer,
                                  int flags)
        Test whether this FunctionItem is deep-equal to another function item, under the rules of the deep-equal function
        Specified by:
        deepEquals in interface FunctionItem
        deepEquals in class MapItem
        other - the other function item
        context - the dynamic evaluation context
        comparer - the object to perform the comparison
        flags - options for how the comparison is performed
        true if the two function items are deep-equal
      • isTrustedResultType

        public boolean isTrustedResultType()
        Description copied from interface: FunctionItem
        Ask if the function can be trusted to return a result of the correct type
        Specified by:
        isTrustedResultType in interface FunctionItem
        isTrustedResultType in class MapItem
        true if the implementation can be trusted
      • toString

        public java.lang.String toString()
        toString in class java.lang.Object