org.apache.cassandra.dht

## Class AbstractBounds<T extends RingPosition<T>>

- java.lang.Object
- - org.apache.cassandra.dht.AbstractBounds<T>

- All Implemented Interfaces:
    java.io.Serializable
  Direct Known Subclasses:
    Bounds, ExcludingBounds, IncludingExcludingBounds, Range

      public abstract class AbstractBounds<T extends RingPosition<T>>
      extends java.lang.Object
      implements java.io.Serializable

  See Also:
    Serialized Form

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `AbstractBounds.AbstractBoundsSerializer<T extends RingPosition<T>>`
    `static class` | `AbstractBounds.Boundary<T extends RingPosition<T>>`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `T` | `left`
    `T` | `right`
    `static IPartitionerDependentSerializer<AbstractBounds<RowPosition>>` | `rowPositionSerializer`
    `static IPartitionerDependentSerializer<AbstractBounds<Token>>` | `tokenSerializer`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `AbstractBounds(T left, T right)`

  - ### Method Summary

    All Methods Static Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static <T extends RingPosition<T>> AbstractBounds<T>` | `bounds(AbstractBounds.Boundary<T> min, AbstractBounds.Boundary<T> max)`
    `static <T extends RingPosition<T>> AbstractBounds<T>` | `bounds(T min, boolean inclusiveMin, T max, boolean inclusiveMax)`
    `abstract boolean` | `contains(T start)`
    `protected abstract java.lang.String` | `getClosingString()`
    `protected abstract java.lang.String` | `getOpeningString()`
    `java.lang.String` | `getString(AbstractType<?> keyValidator)`
    `int` | `hashCode()`
    `abstract boolean` | `inclusiveLeft()`
    `abstract boolean` | `inclusiveRight()`
    `boolean` | `intersects(java.lang.Iterable<Range<T>> ranges)` return true if @param range intersects any of the given @param ranges
    `static <T extends RingPosition<T>> boolean` | `isEmpty(AbstractBounds.Boundary<T> left, AbstractBounds.Boundary<T> right)`
    `AbstractBounds.Boundary<T>` | `leftBoundary()`
    `static <T extends RingPosition<T>> AbstractBounds.Boundary<T>` | `maxLeft(AbstractBounds.Boundary<T> left1, AbstractBounds.Boundary<T> left2)`
    `static <T extends RingPosition<T>> AbstractBounds.Boundary<T>` | `maxLeft(AbstractBounds.Boundary<T> left1, T left2, boolean isInclusiveLeft2)`
    `static <T extends RingPosition<T>> AbstractBounds.Boundary<T>` | `minRight(AbstractBounds.Boundary<T> right1, AbstractBounds.Boundary<T> right2)`
    `static <T extends RingPosition<T>> AbstractBounds.Boundary<T>` | `minRight(AbstractBounds.Boundary<T> right1, T right2, boolean isInclusiveRight2)`
    `static <T extends RingPosition<T>> boolean` | `noneStrictlyWrapsAround(java.util.Collection<AbstractBounds<T>> bounds)`
    `AbstractBounds.Boundary<T>` | `rightBoundary()`
    `abstract Pair<AbstractBounds<T>,AbstractBounds<T>>` | `split(T position)` Given token T and AbstractBounds ?L,R?, returns Pair(?L,T], (T,R?), where ? means that the same type of AbstractBounds is returned as the original.
    `static <T extends RingPosition<T>> boolean` | `strictlyWrapsAround(T left, T right)` Whether `left` and `right` forms a wrapping interval, that is if unwrapping wouldn't be a no-op.
    `abstract java.util.List<? extends AbstractBounds<T>>` | `unwrap()`
    `abstract AbstractBounds<T>` | `withNewRight(T newRight)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### tokenSerializer

          public static final IPartitionerDependentSerializer<AbstractBounds<Token>> tokenSerializer

    - #### rowPositionSerializer

          public static final IPartitionerDependentSerializer<AbstractBounds<RowPosition>> rowPositionSerializer

    - #### left

          public final T extends RingPosition<T> left

    - #### right

          public final T extends RingPosition<T> right

  - ### Constructor Detail

    - #### AbstractBounds

          public AbstractBounds(T left,
                                T right)

  - ### Method Detail

    - #### split

          public abstract Pair<AbstractBounds<T>,AbstractBounds<T>> split(T position)

      Given token T and AbstractBounds ?L,R?, returns Pair(?L,T], (T,R?), where ? means that the same type of AbstractBounds is returned as the original. Put another way, returns a Pair of everything this AbstractBounds contains up to and including the split position, and everything it contains after (not including the split position). The original AbstractBounds must either contain the position T, or T should be equals to the left bound L. If the split would only yield the same AbstractBound, null is returned instead.

    - #### inclusiveLeft

          public abstract boolean inclusiveLeft()

    - #### inclusiveRight

          public abstract boolean inclusiveRight()

    - #### strictlyWrapsAround

          public static <T extends RingPosition<T>> boolean strictlyWrapsAround(T left,
                                                                                T right)

      Whether `left` and `right` forms a wrapping interval, that is if unwrapping wouldn't be a no-op.

      Note that the semantic is slightly different from `Range.isWrapAround()` in the sense that if both `right` are minimal (for the partitioner), this methods return false (doesn't wrap) while `Range.isWrapAround()` returns true (does wrap). This is confusing and we should fix it by refactoring/rewriting the whole AbstractBounds hierarchy with cleaner semantics, but we don't want to risk breaking something by changing `Range.isWrapAround()` in the meantime.

    - #### noneStrictlyWrapsAround

          public static <T extends RingPosition<T>> boolean noneStrictlyWrapsAround(java.util.Collection<AbstractBounds<T>> bounds)

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `java.lang.Object`

    - #### intersects

          public boolean intersects(java.lang.Iterable<Range<T>> ranges)

      return true if @param range intersects any of the given @param ranges

    - #### contains

          public abstract boolean contains(T start)

    - #### unwrap

          public abstract java.util.List<? extends AbstractBounds<T>> unwrap()

    - #### getString

          public java.lang.String getString(AbstractType<?> keyValidator)

    - #### getOpeningString

          protected abstract java.lang.String getOpeningString()

    - #### getClosingString

          protected abstract java.lang.String getClosingString()

    - #### withNewRight

          public abstract AbstractBounds<T> withNewRight(T newRight)

    - #### bounds

          public static <T extends RingPosition<T>> AbstractBounds<T> bounds(AbstractBounds.Boundary<T> min,
                                                                             AbstractBounds.Boundary<T> max)

    - #### bounds

          public static <T extends RingPosition<T>> AbstractBounds<T> bounds(T min,
                                                                             boolean inclusiveMin,
                                                                             T max,
                                                                             boolean inclusiveMax)

    - #### leftBoundary

          public AbstractBounds.Boundary<T> leftBoundary()

    - #### rightBoundary

          public AbstractBounds.Boundary<T> rightBoundary()

    - #### isEmpty

          public static <T extends RingPosition<T>> boolean isEmpty(AbstractBounds.Boundary<T> left,
                                                                    AbstractBounds.Boundary<T> right)

    - #### minRight

          public static <T extends RingPosition<T>> AbstractBounds.Boundary<T> minRight(AbstractBounds.Boundary<T> right1,
                                                                                        T right2,
                                                                                        boolean isInclusiveRight2)

    - #### minRight

          public static <T extends RingPosition<T>> AbstractBounds.Boundary<T> minRight(AbstractBounds.Boundary<T> right1,
                                                                                        AbstractBounds.Boundary<T> right2)

    - #### maxLeft

          public static <T extends RingPosition<T>> AbstractBounds.Boundary<T> maxLeft(AbstractBounds.Boundary<T> left1,
                                                                                       T left2,
                                                                                       boolean isInclusiveLeft2)

    - #### maxLeft

          public static <T extends RingPosition<T>> AbstractBounds.Boundary<T> maxLeft(AbstractBounds.Boundary<T> left1,
                                                                                       AbstractBounds.Boundary<T> left2)

Copyright © 2018 The Apache Software Foundation