Package tech.tablesaw.selection
Interface Selection
-
- All Known Implementing Classes:
BitmapBackedSelection
,BitSetBackedSelection
public interface Selection extends it.unimi.dsi.fastutil.ints.IntIterable
A selection maintains an ordered set of ints that can be used to filter rows from a table or column. When applying the selection to the data (table, column, etc.) only those rows with indexes included in the selection pass the filter
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description Selection
add(int... ints)
Adds the given integers to the Selection if it is not already present, and does nothing otherwiseSelection
addRange(int start, int end)
Adds to the current bitmap all integers in [rangeStart,rangeEnd)Selection
and(Selection otherSelection)
Returns this Selection object after its data has been intersected withotherSelection
Selection
andNot(Selection otherSelection)
Implements the set difference operation between the receiver andotherSelection
, after updating the receiverSelection
clear()
Returns this selection with all its values clearedboolean
contains(int i)
Returns true if the index i is selected in this objectSelection
flip(int rangeStart, int rangeEnd)
Returns a selection with the bits from this selection flipped over the given rangestatic Selection
fromBitmap(org.roaringbitmap.RoaringBitmap bitmap)
int
get(int i)
Returns the value of the ith element.boolean
isEmpty()
Returns true if this selection has no values, and false otherwiseSelection
or(Selection otherSelection)
Returns this Selection object with its data replaced by the union of its starting data andotherSelection
Selection
removeRange(long start, long end)
Removes from the current bitmap from all integers in [rangeStart,rangeEnd)static Selection
selectNRowsAtRandom(int n, int max)
Returns an randomly generated selection of size N where Max is the largest possible valueint
size()
Returns the number of integers represented by this Selectionint[]
toArray()
Returns the elements of this selection as an array of intsstatic Selection
with(int... rows)
Returns a Selection containing all indexes in the arraystatic Selection
withoutRange(int totalRangeStart, int totalRangeEnd, int excludedRangeStart, int excludedRangeEnd)
Returns a Selection containing all values from totalRangeStart to totalRangeEnd, except for those in the range from excludedRangeStart to excludedRangeEnd.static Selection
withRange(int start, int end)
Returns a Selection containing all indexes in the range start (inclusive) to end (exclusive),
-
-
-
Method Detail
-
toArray
int[] toArray()
Returns the elements of this selection as an array of ints
-
add
Selection add(int... ints)
Adds the given integers to the Selection if it is not already present, and does nothing otherwise
-
addRange
Selection addRange(int start, int end)
Adds to the current bitmap all integers in [rangeStart,rangeEnd)- Parameters:
start
- inclusive beginning of rangeend
- exclusive ending of range
-
removeRange
Selection removeRange(long start, long end)
Removes from the current bitmap from all integers in [rangeStart,rangeEnd)- Parameters:
start
- inclusive beginning of rangeend
- exclusive ending of range
-
size
int size()
Returns the number of integers represented by this Selection
-
and
Selection and(Selection otherSelection)
Returns this Selection object after its data has been intersected withotherSelection
-
or
Selection or(Selection otherSelection)
Returns this Selection object with its data replaced by the union of its starting data andotherSelection
-
andNot
Selection andNot(Selection otherSelection)
Implements the set difference operation between the receiver andotherSelection
, after updating the receiver
-
isEmpty
boolean isEmpty()
Returns true if this selection has no values, and false otherwise
-
clear
Selection clear()
Returns this selection with all its values cleared
-
contains
boolean contains(int i)
Returns true if the index i is selected in this object
-
get
int get(int i)
Returns the value of the ith element. For example, if there are three ints {4, 32, 71} in the selection, get(0) returns 4, get(1) returns 32, and get(2) returns 71It can be useful if you need to iterate over the data, although there is also an iterator
-
flip
Selection flip(int rangeStart, int rangeEnd)
Returns a selection with the bits from this selection flipped over the given range
-
selectNRowsAtRandom
static Selection selectNRowsAtRandom(int n, int max)
Returns an randomly generated selection of size N where Max is the largest possible value
-
with
static Selection with(int... rows)
Returns a Selection containing all indexes in the array
-
fromBitmap
static Selection fromBitmap(org.roaringbitmap.RoaringBitmap bitmap)
-
withRange
static Selection withRange(int start, int end)
Returns a Selection containing all indexes in the range start (inclusive) to end (exclusive),
-
withoutRange
static Selection withoutRange(int totalRangeStart, int totalRangeEnd, int excludedRangeStart, int excludedRangeEnd)
Returns a Selection containing all values from totalRangeStart to totalRangeEnd, except for those in the range from excludedRangeStart to excludedRangeEnd. Start values are inclusive, end values exclusive.
-
-