@Override public int countUnique() { ShortSet uniqueElements = new ShortOpenHashSet(); for (int i = 0; i < size(); i++) { short val = getShort(i); if (!isMissingValue(val)) { uniqueElements.add(val); } } return uniqueElements.size(); }
@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; }
@Override public ShortColumn unique() { final ShortSet values = new ShortOpenHashSet(); for (int i = 0; i < size(); i++) { if (!isMissing(i)) { values.add(getShort(i)); } } final ShortColumn column = ShortColumn.create(name() + " Unique values"); for (short value : values) { column.append(value); } return column; }
@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; }
public ShortSet asSet() { return new ShortOpenHashSet(data); }
return new DoubleOpenHashSet(set); } else if (oCls.equals(Short.class)) { return new ShortOpenHashSet(set); } else if (oCls.equals(Byte.class)) { return new ByteOpenHashSet(set);
return new DoubleOpenHashSet(set); } else if (oCls.equals(Short.class)) { return new ShortOpenHashSet(set); } else if (oCls.equals(Byte.class)) { return new ByteOpenHashSet(set);
private Set deserializeSet(final DataInput is) throws IOException, ClassNotFoundException { Object h = deserialize(is); Class oCls = h.getClass(); if (oCls.equals(Integer.class)) { int size = (Integer) h; ObjectOpenHashSet set = new ObjectOpenHashSet(size); for (int i = 0; i < size; i++) { set.add(deserialize(is)); } return set; } else if (oCls.equals(int[].class)) { return new IntOpenHashSet((int[]) h); } else if (oCls.equals(float[].class)) { return new FloatOpenHashSet((float[]) h); } else if (oCls.equals(double[].class)) { return new DoubleOpenHashSet((double[]) h); } else if (oCls.equals(short[].class)) { return new ShortOpenHashSet((short[]) h); } else if (oCls.equals(byte[].class)) { return new ByteOpenHashSet((byte[]) h); } else if (oCls.equals(long[].class)) { return new LongOpenHashSet((long[]) h); } else if (oCls.equals(boolean[].class)) { return new BooleanOpenHashSet((boolean[]) h); } else if (oCls.equals(char[].class)) { return new CharOpenHashSet((char[]) h); } throw new EOFException(); }
private Set deserializeSet(final DataInput is) throws IOException, ClassNotFoundException { Object h = deserialize(is); Class oCls = h.getClass(); if (oCls.equals(Integer.class)) { int size = (Integer) h; ObjectOpenHashSet set = new ObjectOpenHashSet(size); for (int i = 0; i < size; i++) { set.add(deserialize(is)); } return set; } else if (oCls.equals(int[].class)) { return new IntOpenHashSet((int[]) h); } else if (oCls.equals(float[].class)) { return new FloatOpenHashSet((float[]) h); } else if (oCls.equals(double[].class)) { return new DoubleOpenHashSet((double[]) h); } else if (oCls.equals(short[].class)) { return new ShortOpenHashSet((short[]) h); } else if (oCls.equals(byte[].class)) { return new ByteOpenHashSet((byte[]) h); } else if (oCls.equals(long[].class)) { return new LongOpenHashSet((long[]) h); } else if (oCls.equals(boolean[].class)) { return new BooleanOpenHashSet((boolean[]) h); } else if (oCls.equals(char[].class)) { return new CharOpenHashSet((char[]) h); } throw new EOFException(); }
@Override public int countUnique() { ShortSet uniqueElements = new ShortOpenHashSet(); for (int i = 0; i < size(); i++) { short val = getShort(i); if (!isMissingValue(val)) { uniqueElements.add(val); } } return uniqueElements.size(); }
@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; }
@Override public ShortColumn unique() { final ShortSet values = new ShortOpenHashSet(); for (int i = 0; i < size(); i++) { if (!isMissing(i)) { values.add(getShort(i)); } } final ShortColumn column = ShortColumn.create(name() + " Unique values"); for (short value : values) { column.append(value); } return column; }
@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; }