Search in sources :

Example 11 with BitmapBackedSelection

use of tech.tablesaw.selection.BitmapBackedSelection 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;
}
Also used : BitmapBackedSelection(tech.tablesaw.selection.BitmapBackedSelection) Selection(tech.tablesaw.selection.Selection) BitmapBackedSelection(tech.tablesaw.selection.BitmapBackedSelection)

Example 12 with BitmapBackedSelection

use of tech.tablesaw.selection.BitmapBackedSelection 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;
}
Also used : BitmapBackedSelection(tech.tablesaw.selection.BitmapBackedSelection) Selection(tech.tablesaw.selection.Selection) BitmapBackedSelection(tech.tablesaw.selection.BitmapBackedSelection)

Example 13 with BitmapBackedSelection

use of tech.tablesaw.selection.BitmapBackedSelection 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;
}
Also used : BitmapBackedSelection(tech.tablesaw.selection.BitmapBackedSelection) Selection(tech.tablesaw.selection.Selection) BitmapBackedSelection(tech.tablesaw.selection.BitmapBackedSelection)

Example 14 with BitmapBackedSelection

use of tech.tablesaw.selection.BitmapBackedSelection 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;
}
Also used : IntIterator(it.unimi.dsi.fastutil.ints.IntIterator) BitmapBackedSelection(tech.tablesaw.selection.BitmapBackedSelection) Selection(tech.tablesaw.selection.Selection) BitmapBackedSelection(tech.tablesaw.selection.BitmapBackedSelection)

Example 15 with BitmapBackedSelection

use of tech.tablesaw.selection.BitmapBackedSelection in project symja_android_library by axkr.

the class ByteDictionaryMap method selectIsIn.

@Override
public Selection selectIsIn(String... strings) {
    ByteOpenHashSet keys = new ByteOpenHashSet();
    for (String string : strings) {
        byte key = getKeyForValue(string);
        if (key != DEFAULT_RETURN_VALUE) {
            keys.add(key);
        }
    }
    Selection results = new BitmapBackedSelection();
    for (int i = 0; i < values.size(); i++) {
        if (keys.contains(values.getByte(i))) {
            results.add(i);
        }
    }
    return results;
}
Also used : BitmapBackedSelection(tech.tablesaw.selection.BitmapBackedSelection) Selection(tech.tablesaw.selection.Selection) BitmapBackedSelection(tech.tablesaw.selection.BitmapBackedSelection) ByteOpenHashSet(it.unimi.dsi.fastutil.bytes.ByteOpenHashSet)

Aggregations

BitmapBackedSelection (tech.tablesaw.selection.BitmapBackedSelection)79 Selection (tech.tablesaw.selection.Selection)79 IntArrayList (it.unimi.dsi.fastutil.ints.IntArrayList)31 PivotTable (tech.tablesaw.aggregate.PivotTable)3 ByteOpenHashSet (it.unimi.dsi.fastutil.bytes.ByteOpenHashSet)2 IntIterator (it.unimi.dsi.fastutil.ints.IntIterator)2 IntOpenHashSet (it.unimi.dsi.fastutil.ints.IntOpenHashSet)2 ShortOpenHashSet (it.unimi.dsi.fastutil.shorts.ShortOpenHashSet)2 IExpr (org.matheclipse.core.interfaces.IExpr)2 ByteArrayList (it.unimi.dsi.fastutil.bytes.ByteArrayList)1 ByteIterator (it.unimi.dsi.fastutil.bytes.ByteIterator)1 IntRBTreeSet (it.unimi.dsi.fastutil.ints.IntRBTreeSet)1 ByteBuffer (java.nio.ByteBuffer)1 HashMap (java.util.HashMap)1 LinkedHashMap (java.util.LinkedHashMap)1 CategoricalColumn (tech.tablesaw.api.CategoricalColumn)1 DoubleColumn (tech.tablesaw.api.DoubleColumn)1 Column (tech.tablesaw.columns.Column)1