Class LongPairRangeSet.DefaultRangeSet<T extends java.lang.Comparable<T>>

  • Type Parameters:
    T - the type of values in ranges.
    All Implemented Interfaces:
    LongPairRangeSet<T>
    Enclosing interface:
    LongPairRangeSet<T extends java.lang.Comparable<T>>

    public static class LongPairRangeSet.DefaultRangeSet<T extends java.lang.Comparable<T>>
    extends java.lang.Object
    implements LongPairRangeSet<T>
    Generic implementation of a default range set.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addOpenClosed​(long key1, long value1, long key2, long value2)
      Adds the specified range (range that contains all values strictly greater than lower and less than or equal to upper.) to this RangeSet (optional operation).
      java.util.Set<com.google.common.collect.Range<T>> asRanges()
      Returns a view of the disconnected ranges that make up this range set.
      int cardinality​(long lowerKey, long lowerValue, long upperKey, long upperValue)
      Return the number bit sets to true from lower (inclusive) to upper (inclusive).
      void clear()  
      boolean contains​(long key, long value)
      Determines whether any of this range set's member ranges contains value.
      boolean contains​(T position)  
      com.google.common.collect.Range<T> firstRange()
      It returns very first smallest range in the rangeSet.
      void forEach​(LongPairRangeSet.RangeProcessor<T> action)
      Performs the given action for each entry in this map until all entries have been processed or action returns "false".
      void forEach​(LongPairRangeSet.RangeProcessor<T> action, LongPairRangeSet.LongPairConsumer<? extends T> consumer)
      Performs the given action for each entry in this map until all entries have been processed or action returns "false".
      boolean isEmpty()  
      com.google.common.collect.Range<T> lastRange()
      It returns very last biggest range in the rangeSet.
      com.google.common.collect.Range<T> rangeContaining​(long key, long value)
      Returns the unique range from this range set that contains value, or null if this range set does not contain value.
      com.google.common.collect.Range<T> rangeContaining​(T position)  
      void remove​(com.google.common.collect.Range<T> range)  
      void removeAtMost​(long key, long value)
      Remove range that contains all values less than or equal to given key-value.
      int size()
      Returns total number of ranges into the set.
      com.google.common.collect.Range<T> span()
      Returns the minimal range which encloses all ranges in this range set.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Method Detail

      • clear

        public void clear()
        Specified by:
        clear in interface LongPairRangeSet<T extends java.lang.Comparable<T>>
      • addOpenClosed

        public void addOpenClosed​(long key1,
                                  long value1,
                                  long key2,
                                  long value2)
        Description copied from interface: LongPairRangeSet
        Adds the specified range (range that contains all values strictly greater than lower and less than or equal to upper.) to this RangeSet (optional operation). That is, for equal range sets a and b, the result of a.add(range) is that a will be the minimal range set for which both a.enclosesAll(b) and a.encloses(range).
        
         @param lowerKey :  value for key of lowerEndpoint of Range
         @param lowerValue: value for value of lowerEndpoint of Range
         @param upperKey  : value for key of upperEndpoint of Range
         @param upperValue: value for value of upperEndpoint of Range
         
        Specified by:
        addOpenClosed in interface LongPairRangeSet<T extends java.lang.Comparable<T>>
      • contains

        public boolean contains​(T position)
      • rangeContaining

        public com.google.common.collect.Range<T> rangeContaining​(T position)
      • rangeContaining

        public com.google.common.collect.Range<T> rangeContaining​(long key,
                                                                  long value)
        Description copied from interface: LongPairRangeSet
        Returns the unique range from this range set that contains value, or null if this range set does not contain value.
        Specified by:
        rangeContaining in interface LongPairRangeSet<T extends java.lang.Comparable<T>>
      • remove

        public void remove​(com.google.common.collect.Range<T> range)
      • removeAtMost

        public void removeAtMost​(long key,
                                 long value)
        Description copied from interface: LongPairRangeSet
        Remove range that contains all values less than or equal to given key-value.
        Specified by:
        removeAtMost in interface LongPairRangeSet<T extends java.lang.Comparable<T>>
      • isEmpty

        public boolean isEmpty()
        Specified by:
        isEmpty in interface LongPairRangeSet<T extends java.lang.Comparable<T>>
      • span

        public com.google.common.collect.Range<T> span()
        Description copied from interface: LongPairRangeSet
        Returns the minimal range which encloses all ranges in this range set.
        Specified by:
        span in interface LongPairRangeSet<T extends java.lang.Comparable<T>>
        Returns:
      • asRanges

        public java.util.Set<com.google.common.collect.Range<T>> asRanges()
        Description copied from interface: LongPairRangeSet
        Returns a view of the disconnected ranges that make up this range set.
        Specified by:
        asRanges in interface LongPairRangeSet<T extends java.lang.Comparable<T>>
        Returns:
      • forEach

        public void forEach​(LongPairRangeSet.RangeProcessor<T> action)
        Description copied from interface: LongPairRangeSet
        Performs the given action for each entry in this map until all entries have been processed or action returns "false". Unless otherwise specified by the implementing class, actions are performed in the order of entry set iteration (if an iteration order is specified.)
        Specified by:
        forEach in interface LongPairRangeSet<T extends java.lang.Comparable<T>>
      • forEach

        public void forEach​(LongPairRangeSet.RangeProcessor<T> action,
                            LongPairRangeSet.LongPairConsumer<? extends T> consumer)
        Description copied from interface: LongPairRangeSet
        Performs the given action for each entry in this map until all entries have been processed or action returns "false". Unless otherwise specified by the implementing class, actions are performed in the order of entry set iteration (if an iteration order is specified.)
        Specified by:
        forEach in interface LongPairRangeSet<T extends java.lang.Comparable<T>>
      • contains

        public boolean contains​(long key,
                                long value)
        Description copied from interface: LongPairRangeSet
        Determines whether any of this range set's member ranges contains value.
        Specified by:
        contains in interface LongPairRangeSet<T extends java.lang.Comparable<T>>
      • firstRange

        public com.google.common.collect.Range<T> firstRange()
        Description copied from interface: LongPairRangeSet
        It returns very first smallest range in the rangeSet.
        Specified by:
        firstRange in interface LongPairRangeSet<T extends java.lang.Comparable<T>>
        Returns:
        first smallest range into the set
      • lastRange

        public com.google.common.collect.Range<T> lastRange()
        Description copied from interface: LongPairRangeSet
        It returns very last biggest range in the rangeSet.
        Specified by:
        lastRange in interface LongPairRangeSet<T extends java.lang.Comparable<T>>
        Returns:
        last biggest range into the set
      • cardinality

        public int cardinality​(long lowerKey,
                               long lowerValue,
                               long upperKey,
                               long upperValue)
        Description copied from interface: LongPairRangeSet
        Return the number bit sets to true from lower (inclusive) to upper (inclusive).
        Specified by:
        cardinality in interface LongPairRangeSet<T extends java.lang.Comparable<T>>
      • size

        public int size()
        Description copied from interface: LongPairRangeSet
        Returns total number of ranges into the set.
        Specified by:
        size in interface LongPairRangeSet<T extends java.lang.Comparable<T>>
        Returns:
      • toString

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