Class LongRangeMap

  • All Implemented Interfaces:
    java.io.Serializable

    public class LongRangeMap
    extends java.lang.Object
    implements java.io.Serializable
    Stores ranges of long values throughout "long" space. Every "long" index has an associated long value (initially 0). Users can paint (set) ranges of indexes to a given integer value, overwriting any value that currently exists in that range. This class is implemented using a LongPropertySet. 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
    • Constructor Summary

      Constructors 
      Constructor Description
      LongRangeMap()
      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 index range iterator over all occupied ranges in the map
      long getValue​(long index)
      Returns the long value associated with the given index.
      void paintRange​(long start, long end, long 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
    • Constructor Detail

      • LongRangeMap

        public LongRangeMap()
        Constructor for RangeMap.
    • Method Detail

      • paintRange

        public void paintRange​(long start,
                               long end,
                               long 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 long getValue​(long index)
        Returns the long value associated with the given index.
        Parameters:
        index - the index at which to get the value.
      • getIndexRangeIterator

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

        public LongIterator getChangePointIterator​(long start,
                                                   long end)
        Returns an iterator over all indexes where the value changes. The value is considered to change when it goes from one value to another, or goes from no value to a value or goes from a value to no value.
        Parameters:
        start - the starting index to search.
        end - the ending index to search.
        Returns:
        iterator over all indexes where value changes occur.