Class ShortRangeMap

  • All Implemented Interfaces:
    java.io.Serializable

    public class ShortRangeMap
    extends java.lang.Object
    implements java.io.Serializable
    Stores ranges of short values throughout "long" space. Every "long" index has an associated short value (initially 0). Users can paint (set) ranges of indexes to a given short integer value, overwriting any value that currently exists in that range. This class is implemented using an ShortPropertySet. The first index (0) will always contain a value. The value at any other given index will either be the value stored at that index, or if no value stored there, then the value stored at the nearest previous index that contains a value.
    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static long LARGEST
      The maximum end of range index allowed.
    • Constructor Summary

      Constructors 
      Constructor Description
      ShortRangeMap()
      Constructor for RangeMap.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      LongIterator getChangePointIterator​(long start, long end)
      Returns an iterator over all indexes where the value changes.
      IndexRangeIterator getIndexRangeIterator​(long index)
      Returns an iterator over all occupied ranges in the map.
      short getValue​(long index)
      Returns the short value associated with the given index.
      void paintRange​(long start, long end, short value)
      Associates the given value with every index from start to end (inclusive) Any previous associates are overwritten.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • LARGEST

        public static final long LARGEST
        The maximum end of range index allowed.
        See Also:
        Constant Field Values
    • Constructor Detail

      • ShortRangeMap

        public ShortRangeMap()
        Constructor for RangeMap.
    • Method Detail

      • paintRange

        public void paintRange​(long start,
                               long end,
                               short value)
        Associates the given value with every index from start to end (inclusive) Any previous associates are overwritten.
        Parameters:
        start - the start index of the range to fill.
        end - the end index of the range to fill
        value - the value to put at every index in the range.
      • getValue

        public short getValue​(long index)
        Returns the short value associated with the given index.
        Parameters:
        index - the index at which to get the value.
      • getIndexRangeIterator

        public IndexRangeIterator getIndexRangeIterator​(long index)
        Returns an iterator over all occupied ranges in the map.
        Parameters:
        index - the index to start the iterator
        Returns:
        an iterator over all occupied ranges in the map.
      • getChangePointIterator

        public LongIterator getChangePointIterator​(long start,
                                                   long end)
        Returns an iterator over all indexes where the value changes.
        Parameters:
        start - the starting index to search.
        end - the ending index to search.
        Returns:
        an iterator over all indexes where the value changes.