@Override public int countUnique() { ByteSet count = new ByteOpenHashSet(3); for (byte next : data) { count.add(next); } return count.size(); }
@Override public BooleanColumn unique() { ByteSet count = new ByteOpenHashSet(3); for (byte next : data) { count.add(next); } ByteArrayList list = new ByteArrayList(count); return new BooleanColumn(name() + " Unique values", list); }
@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; }
@Override public Selection selectIsIn(Collection<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; }
@Override public int countUnique() { ByteSet count = new ByteOpenHashSet(3); for (byte next : data) { count.add(next); } return count.size(); }
@Override public int countUnique() { ByteSet count = new ByteOpenHashSet(3); for (byte next : data) { count.add(next); } return count.size(); }
return new ShortOpenHashSet(set); } else if (oCls.equals(Byte.class)) { return new ByteOpenHashSet(set); } else if (oCls.equals(Long.class)) { return new LongOpenHashSet(set);
@Override public BooleanColumn unique() { ByteSet count = new ByteOpenHashSet(3); for (byte next : data) { count.add(next); } ByteArrayList list = new ByteArrayList(count); return new BooleanColumn(name() + " Unique values", list); }
@Override public BooleanColumn unique() { ByteSet count = new ByteOpenHashSet(3); for (byte next : data) { count.add(next); } ByteArrayList list = new ByteArrayList(count); return new BooleanColumn(name() + " Unique values", list); }
return new ShortOpenHashSet(set); } else if (oCls.equals(Byte.class)) { return new ByteOpenHashSet(set); } else if (oCls.equals(Long.class)) { return new LongOpenHashSet(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(); }
/** * Remove all active effects */ public void removeAll() { ByteSet removeEffects = null; for ( Byte2ObjectMap.Entry<Effect> entry : this.effects.byte2ObjectEntrySet() ) { if ( removeEffects == null ) { removeEffects = new ByteOpenHashSet(); } removeEffects.add( entry.getByteKey() ); } if ( removeEffects != null ) { for ( Byte removeEffect : removeEffects ) { removeEffect( removeEffect ); } } }
@Override public Selection selectIsIn(Collection<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; }
@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; }
/** * Update effects (look if we can remove some) * * @param currentTimeMillis time when the tick started * @param dT difference time for a full second */ public void update( long currentTimeMillis, float dT ) { if ( !this.effects.isEmpty() ) { ByteSet removeEffects = null; for ( Byte2ObjectMap.Entry<Effect> entry : this.effects.byte2ObjectEntrySet() ) { if ( currentTimeMillis >= entry.getValue().getRunoutTimer() ) { if ( removeEffects == null ) { removeEffects = new ByteOpenHashSet(); } removeEffects.add( entry.getByteKey() ); } else { entry.getValue().update( currentTimeMillis, dT ); } } if ( removeEffects != null ) { for ( Byte removeEffect : removeEffects ) { removeEffect( removeEffect ); } } } }
ByteSet subChunkSet = this.subChunksProcessed.get( hash ); if ( subChunkSet == null ) { subChunkSet = new ByteOpenHashSet(); this.subChunksProcessed.put( hash, subChunkSet );