Search in sources :

Example 1 with ShortOpenHashSet

use of it.unimi.dsi.fastutil.shorts.ShortOpenHashSet in project symja_android_library by axkr.

the class ShortColumn method unique.

@Override
public ShortColumn unique() {
    final ShortSet values = new ShortOpenHashSet();
    for (int i = 0; i < size(); i++) {
        values.add(getShort(i));
    }
    final ShortColumn column = ShortColumn.create(name() + " Unique values");
    for (short value : values) {
        column.append(value);
    }
    return column;
}
Also used : ShortSet(it.unimi.dsi.fastutil.shorts.ShortSet) ShortOpenHashSet(it.unimi.dsi.fastutil.shorts.ShortOpenHashSet)

Example 2 with ShortOpenHashSet

use of it.unimi.dsi.fastutil.shorts.ShortOpenHashSet in project symja_android_library by axkr.

the class ShortDictionaryMap method selectIsIn.

@Override
public Selection selectIsIn(Collection<String> strings) {
    ShortOpenHashSet keys = new ShortOpenHashSet(strings.size());
    for (String string : strings) {
        short 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.getShort(i))) {
            results.add(i);
        }
    }
    return results;
}
Also used : BitmapBackedSelection(tech.tablesaw.selection.BitmapBackedSelection) Selection(tech.tablesaw.selection.Selection) BitmapBackedSelection(tech.tablesaw.selection.BitmapBackedSelection) ShortOpenHashSet(it.unimi.dsi.fastutil.shorts.ShortOpenHashSet)

Example 3 with ShortOpenHashSet

use of it.unimi.dsi.fastutil.shorts.ShortOpenHashSet in project symja_android_library by axkr.

the class ShortDictionaryMap method selectIsIn.

@Override
public Selection selectIsIn(String... strings) {
    ShortOpenHashSet keys = new ShortOpenHashSet(strings.length);
    for (String string : strings) {
        short 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.getShort(i))) {
            results.add(i);
        }
    }
    return results;
}
Also used : BitmapBackedSelection(tech.tablesaw.selection.BitmapBackedSelection) Selection(tech.tablesaw.selection.Selection) BitmapBackedSelection(tech.tablesaw.selection.BitmapBackedSelection) ShortOpenHashSet(it.unimi.dsi.fastutil.shorts.ShortOpenHashSet)

Aggregations

ShortOpenHashSet (it.unimi.dsi.fastutil.shorts.ShortOpenHashSet)3 BitmapBackedSelection (tech.tablesaw.selection.BitmapBackedSelection)2 Selection (tech.tablesaw.selection.Selection)2 ShortSet (it.unimi.dsi.fastutil.shorts.ShortSet)1