Class TreeRangeSet.SubRangeSet

  • All Implemented Interfaces:
    RangeSet<C>, java.io.Serializable
    Enclosing class:
    TreeRangeSet<C extends java.lang.Comparable<?>>

    private final class TreeRangeSet.SubRangeSet
    extends TreeRangeSet<C>
    • Field Detail

      • restriction

        private final Range<C extends java.lang.Comparable<?>> restriction
    • Constructor Detail

      • SubRangeSet

        SubRangeSet​(Range<C> restriction)
    • Method Detail

      • encloses

        public boolean encloses​(Range<C> range)
        Description copied from interface: RangeSet
        Returns true if there exists a member range in this range set which encloses the specified range.
        Specified by:
        encloses in interface RangeSet<C extends java.lang.Comparable<?>>
        Overrides:
        encloses in class TreeRangeSet<C extends java.lang.Comparable<?>>
      • rangeContaining

        public Range<C> rangeContaining​(C value)
        Description copied from interface: RangeSet
        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 RangeSet<C extends java.lang.Comparable<?>>
        Overrides:
        rangeContaining in class TreeRangeSet<C extends java.lang.Comparable<?>>
      • add

        public void add​(Range<C> rangeToAdd)
        Description copied from interface: RangeSet
        Adds the specified range 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).

        Note that range will be coalesced with any ranges in the range set that are connected with it. Moreover, if range is empty, this is a no-op.

        Specified by:
        add in interface RangeSet<C extends java.lang.Comparable<?>>
        Overrides:
        add in class TreeRangeSet<C extends java.lang.Comparable<?>>
      • remove

        public void remove​(Range<C> rangeToRemove)
        Description copied from interface: RangeSet
        Removes the specified range from this RangeSet (optional operation). After this operation, if range.contains(c), this.contains(c) will return false.

        If range is empty, this is a no-op.

        Specified by:
        remove in interface RangeSet<C extends java.lang.Comparable<?>>
        Overrides:
        remove in class TreeRangeSet<C extends java.lang.Comparable<?>>
      • contains

        public boolean contains​(C value)
        Description copied from interface: RangeSet
        Determines whether any of this range set's member ranges contains value.
        Specified by:
        contains in interface RangeSet<C extends java.lang.Comparable<?>>
        Overrides:
        contains in class AbstractRangeSet<C extends java.lang.Comparable<?>>
      • clear

        public void clear()
        Description copied from interface: RangeSet
        Removes all ranges from this RangeSet (optional operation). After this operation, this.contains(c) will return false for all c.

        This is equivalent to remove(Range.all()).

        Specified by:
        clear in interface RangeSet<C extends java.lang.Comparable<?>>
        Overrides:
        clear in class AbstractRangeSet<C extends java.lang.Comparable<?>>
      • subRangeSet

        public RangeSet<C> subRangeSet​(Range<C> view)
        Description copied from interface: RangeSet
        Returns a view of the intersection of this RangeSet with the specified range.

        The returned view supports all optional operations supported by this RangeSet, with the caveat that an IllegalArgumentException is thrown on an attempt to add any range not enclosed by view.

        Specified by:
        subRangeSet in interface RangeSet<C extends java.lang.Comparable<?>>
        Overrides:
        subRangeSet in class TreeRangeSet<C extends java.lang.Comparable<?>>