use of tech.tablesaw.selection.Selection in project symja_android_library by axkr.
the class IntColumn method isNotIn.
public Selection isNotIn(final int... numbers) {
final Selection results = new BitmapBackedSelection();
results.addRange(0, size());
results.andNot(isIn(numbers));
return results;
}
use of tech.tablesaw.selection.Selection in project symja_android_library by axkr.
the class IntColumn method isIn.
public Selection isIn(final int... numbers) {
final Selection results = new BitmapBackedSelection();
final IntRBTreeSet intSet = new IntRBTreeSet(numbers);
for (int i = 0; i < size(); i++) {
if (intSet.contains(getInt(i))) {
results.add(i);
}
}
return results;
}
use of tech.tablesaw.selection.Selection in project symja_android_library by axkr.
the class NumberFilters method isCloseTo.
// TODO(lwhite): see section in Effective Java on double point comparisons.
default Selection isCloseTo(Number target, Number margin) {
Selection results = new BitmapBackedSelection();
for (int i = 0; i < size(); i++) {
double targetValue = target.doubleValue();
double marginValue = margin.doubleValue();
double val = getDouble(i);
if (val > targetValue - marginValue && val < targetValue + marginValue) {
results.add(i);
}
}
return results;
}
use of tech.tablesaw.selection.Selection in project symja_android_library by axkr.
the class BooleanMapUtils method andNot.
/**
* Returns a column made by combining the receiver and each of the arguments using the operation:
* A andNot V. For example, the value of a cell in the result column would be true if the
* corresponding value in A is true and the corresponding value in B is false
*/
default BooleanColumn andNot(BooleanColumn... columns) {
StringBuilder name = new StringBuilder(name()).append(" and not: ");
Selection selection = asSelection();
for (BooleanColumn column : columns) {
if (!column.name().equals(columns[0].name())) {
name.append(", ");
}
name.append(column.name());
selection.andNot(column.asSelection());
}
return BooleanColumn.create(name.toString(), selection, size());
}
use of tech.tablesaw.selection.Selection in project symja_android_library by axkr.
the class DateFilters method eval.
/**
* This version operates on predicates that treat the given IntPredicate as operating on a packed
* local time This is much more efficient that using a LocalTimePredicate, but requires that the
* developer understand the semantics of packedLocalTimes
*/
default Selection eval(IntPredicate predicate) {
Selection selection = new BitmapBackedSelection();
IntIterator iterator = intIterator();
int idx = 0;
while (iterator.hasNext()) {
int next = iterator.nextInt();
if (predicate.test(next)) {
selection.add(idx);
}
idx++;
}
return selection;
}
Aggregations