Package tech.tablesaw.selection
Interface Selection
- All Known Implementing Classes:
BitmapBackedSelection
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
Modifier and TypeMethodDescriptionadd
(int... ints) Adds the given integers to the Selection if it is not already present, and does nothing otherwiseaddRange
(int start, int end) Adds to the current bitmap all integers in [rangeStart,rangeEnd)Returns this Selection object after its data has been intersected withotherSelection
Implements the set difference operation between the receiver andotherSelection
, after updating the receiverclear()
Returns this selection with all its values clearedboolean
contains
(int i) Returns true if the index i is selected in this objectflip
(int rangeStart, int rangeEnd) Returns a selection with the bits from this selection flipped over the given rangeint
get
(int i) Returns the value of the ith element.boolean
isEmpty()
Returns true if this selection has no values, and false otherwiseReturns this Selection object with its data replaced by the union of its starting data andotherSelection
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),Methods inherited from interface it.unimi.dsi.fastutil.ints.IntIterable
forEach, forEach, forEach, intIterator, intSpliterator, iterator, spliterator
-
Method Details
-
toArray
int[] toArray()Returns the elements of this selection as an array of ints -
add
Adds the given integers to the Selection if it is not already present, and does nothing otherwise -
addRange
Adds to the current bitmap all integers in [rangeStart,rangeEnd)- Parameters:
start
- inclusive beginning of rangeend
- exclusive ending of range
-
removeRange
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
Returns this Selection object after its data has been intersected withotherSelection
-
or
Returns this Selection object with its data replaced by the union of its starting data andotherSelection
-
andNot
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
Returns a selection with the bits from this selection flipped over the given range -
selectNRowsAtRandom
Returns an randomly generated selection of size N where Max is the largest possible value -
with
Returns a Selection containing all indexes in the array -
withRange
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.
-