Package 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 ofSlice
, though those are guaranteed to be non-overlapping and always in clustering order.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Slices.Builder
Builder to createSlices
objects.static interface
Slices.InOrderTester
In simple object that allows to test the inclusion of rows in those slices assuming those rows are passed (toSlices.InOrderTester.includes(org.apache.cassandra.db.Clustering<?>)
) in clustering order (or reverse clustering ordered, depending on the argument passed toinOrderTester(boolean)
).static class
Slices.Serializer
-
Field Summary
Fields Modifier and Type Field 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 Description protected
Slices()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description ClusteringBound<?>
end()
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 thisSlices
object.abstract boolean
hasLowerBound()
Whether the slices instance has a lower bound, that is whether it's first slice start isSlice.BOTTOM
.abstract boolean
hasUpperBound()
Whether the slices instance has an upper bound, that is whether it's last slice end isSlice.TOP
.abstract Slices.InOrderTester
inOrderTester(boolean reversed)
An object that allows to test whether rows are selected by thisSlices
objects assuming those rows are tested in clustering order.abstract boolean
intersects(Slice slice)
Checks whether any of the slices intersects witht the given one.boolean
isEmpty()
Checks if thisSlices
is empty.abstract boolean
selects(Clustering<?> clustering)
Whether a given clustering (row) is selected by thisSlices
object.abstract int
size()
The number of slice this object contains.ClusteringBound<?>
start()
abstract java.lang.String
toCQLString(TableMetadata metadata, RowFilter rowFilter)
static Slices
with(ClusteringComparator comparator, Slice slice)
Creates aSlices
object that contains a single slice.
-
-
-
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.
-
-
Method Detail
-
with
public static Slices with(ClusteringComparator comparator, Slice slice)
Creates aSlices
object that contains a single slice.- Parameters:
comparator
- the comparator for the tableslice
is a slice of.slice
- the single slice that the return object should contain.- Returns:
- the newly created
Slices
object.
-
hasLowerBound
public abstract boolean hasLowerBound()
Whether the slices instance has a lower bound, that is whether it's first slice start isSlice.BOTTOM
.- Returns:
- whether this slices instance has a lower bound.
-
hasUpperBound
public abstract boolean hasUpperBound()
Whether the slices instance has an upper bound, that is whether it's last slice end isSlice.TOP
.- Returns:
- whether this slices instance 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 thisSlices
object.- Returns:
- the ith slice of this object.
-
start
public ClusteringBound<?> start()
-
end
public ClusteringBound<?> end()
-
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 afterlastReturned
are returned (where coming after means "greater than" if!reversed
and "lesser than" otherwise).inclusive
- whether we want to include thelastReturned
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 thisSlices
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 thisSlices
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(Slice slice)
Checks whether any of the slices intersects witht the given one.- Returns:
true
if there exists a slice which (Slice.intersects(ClusteringComparator, Slice)
) with the provided slice
-
toCQLString
public abstract java.lang.String toCQLString(TableMetadata metadata, RowFilter rowFilter)
-
isEmpty
public final boolean isEmpty()
Checks if thisSlices
is empty.- Returns:
true
if thisSlices
is empty,false
otherwise.
-
-