org.apache.cassandra.db

## Class Slices

- java.lang.Object
- - org.apache.cassandra.db.Slices

- All Implemented Interfaces:
    java.lang.Iterable<Slice>

      public abstract class Slices
      extends java.lang.Object
      implements java.lang.Iterable<Slice>

  Represents the selection of multiple range of rows within a partition.

  A `Slices` is basically a list of `Slice`, though those are guaranteed to be non-overlapping and always in clustering order.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `Slices.Builder` Builder to create `Slices` objects.
    `static interface` | `Slices.InOrderTester` In simple object that allows to test the inclusion of rows in those slices assuming those rows are passed (to `Slices.InOrderTester.includes(org.apache.cassandra.db.Clustering)`) in clustering order (or reverse clustering ordered, depending of the argument passed to `inOrderTester(boolean)`).
    `static class` | `Slices.Serializer`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static Slices` | `ALL` Slices selecting all the rows of a partition.
    `static Slices` | `NONE` Slices selecting no rows in a partition.
    `static Slices.Serializer` | `serializer`

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `Slices()`

  - ### Method Summary

    All Methods Static Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `abstract Slices` | `forPaging(ClusteringComparator comparator, Clustering lastReturned, boolean inclusive, boolean reversed)` Returns slices for continuing the paging of those slices given the last returned clustering prefix.
    `abstract Slice` | `get(int i)` Returns the ith slice of this `Slices` object.
    `abstract boolean` | `hasLowerBound()` Whether the slices has a lower bound, that is whether it's first slice start is `Slice.BOTTOM`.
    `abstract boolean` | `hasUpperBound()` Whether the slices has an upper bound, that is whether it's last slice end is `Slice.TOP`.
    `abstract Slices.InOrderTester` | `inOrderTester(boolean reversed)` An object that allows to test whether rows are selected by this `Slices` objects assuming those rows are tested in clustering order.
    `abstract boolean` | `intersects(java.util.List<java.nio.ByteBuffer> minClusteringValues, java.util.List<java.nio.ByteBuffer> maxClusteringValues)` Given the per-clustering column minimum and maximum value a sstable contains, whether or not this slices potentially intersects that sstable or not.
    `boolean` | `isEmpty()` Checks if this `Slices` is empty.
    `abstract boolean` | `selects(Clustering clustering)` Whether a given clustering (row) is selected by this `Slices` object.
    `abstract int` | `size()` The number of slice this object contains.
    `abstract java.lang.String` | `toCQLString(CFMetaData metadata)`
    `static Slices` | `with(ClusteringComparator comparator, Slice slice)` Creates a `Slices` object that contains a single slice.

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

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

    - ### Methods inherited from interface java.lang.Iterable

      `forEach, iterator, spliterator`

- - ### Field Detail

    - #### serializer

          public static final Slices.Serializer serializer

    - #### ALL

          public static final Slices ALL

      Slices selecting all the rows of a partition.

    - #### NONE

          public static final Slices NONE

      Slices selecting no rows in a partition.

  - ### Constructor Detail

    - #### Slices

          protected Slices()

  - ### Method Detail

    - #### with

          public static Slices with(ClusteringComparator comparator,
                                    Slice slice)

      Creates a `Slices` object that contains a single slice.
      Parameters:
        `comparator` - the comparator for the table `slice` is a slice of.
        `slice` - the single slice that the return object should contains.
      Returns:
        the newly created `Slices` object.

    - #### hasLowerBound

          public abstract boolean hasLowerBound()

      Whether the slices has a lower bound, that is whether it's first slice start is `Slice.BOTTOM`.
      Returns:
        whether the slices has a lower bound.

    - #### hasUpperBound

          public abstract boolean hasUpperBound()

      Whether the slices has an upper bound, that is whether it's last slice end is `Slice.TOP`.
      Returns:
        whether the slices has an upper bound.

    - #### size

          public abstract int size()

      The number of slice this object contains.
      Returns:
        the number of slice this object contains.

    - #### get

          public abstract Slice get(int i)

      Returns the ith slice of this `Slices` object.
      Returns:
        the ith slice of this object.

    - #### forPaging

          public abstract Slices forPaging(ClusteringComparator comparator,
                                           Clustering lastReturned,
                                           boolean inclusive,
                                           boolean reversed)

      Returns slices for continuing the paging of those slices given the last returned clustering prefix.
      Parameters:
        `comparator` - the comparator for the table this is a filter for.
        `lastReturned` - the last clustering that was returned for the query we are paging for. The resulting slices will be such that only results coming stricly after `lastReturned` are returned (where coming after means "greater than" if `!reversed` and "lesser than" otherwise).
        `inclusive` - whether or not we want to include the `lastReturned` in the newly returned page of results.
        `reversed` - whether the query we're paging for is reversed or not.
      Returns:
        new slices that select results coming after `lastReturned`.

    - #### inOrderTester

          public abstract Slices.InOrderTester inOrderTester(boolean reversed)

      An object that allows to test whether rows are selected by this `Slices` objects assuming those rows are tested in clustering order.
      Parameters:
        `reversed` - if true, the rows passed to the returned object will be assumed to be in reversed clustering order, otherwise they should be in clustering order.
      Returns:
        an object that tests for selection of rows by this `Slices` object.

    - #### selects

          public abstract boolean selects(Clustering clustering)

      Whether a given clustering (row) is selected by this `Slices` object.
      Parameters:
        `clustering` - the clustering to test for selection.
      Returns:
        whether a given clustering (row) is selected by this `Slices` object.

    - #### intersects

          public abstract boolean intersects(java.util.List<java.nio.ByteBuffer> minClusteringValues,
                                             java.util.List<java.nio.ByteBuffer> maxClusteringValues)

      Given the per-clustering column minimum and maximum value a sstable contains, whether or not this slices potentially intersects that sstable or not.
      Parameters:
        `minClusteringValues` - the smallest values for each clustering column that a sstable contains.
        `maxClusteringValues` - the biggest values for each clustering column that a sstable contains.
      Returns:
        whether the slices might intersects with the sstable having `minClusteringValues` and `maxClusteringValues`.

    - #### toCQLString

          public abstract java.lang.String toCQLString(CFMetaData metadata)

    - #### isEmpty

          public final boolean isEmpty()

      Checks if this `Slices` is empty.
      Returns:
        `true` if this `Slices` is empty, `false` otherwise.

Copyright © 2018 The Apache Software Foundation