public BooleanSet asSet() { BooleanSet set = new BooleanOpenHashSet(3); BooleanColumn unique = unique(); for (int i = 0; i < unique.size(); i++) { set.add((boolean) unique.get(i)); } return set; }
@SuppressWarnings("unchecked") public static Set<?> toFastutilHashSet(Set<?> set, Type type, FunctionRegistry registry) { // 0.25 as the load factor is chosen because the argument set is assumed to be small (<10000), // and the return set is assumed to be read-heavy. // The performance of InCodeGenerator heavily depends on the load factor being small. Class<?> javaElementType = type.getJavaType(); if (javaElementType == long.class) { return new LongOpenCustomHashSet((Collection<Long>) set, 0.25f, new LongStrategy(registry, type)); } if (javaElementType == double.class) { return new DoubleOpenCustomHashSet((Collection<Double>) set, 0.25f, new DoubleStrategy(registry, type)); } if (javaElementType == boolean.class) { return new BooleanOpenHashSet((Collection<Boolean>) set, 0.25f); } else if (!type.getJavaType().isPrimitive()) { return new ObjectOpenCustomHashSet(set, 0.25f, new ObjectStrategy(registry, type)); } else { throw new UnsupportedOperationException("Unsupported native type in set: " + type.getJavaType() + " with type " + type.getTypeSignature()); } }
return new LongOpenHashSet(set); } else if (oCls.equals(Boolean.class)) { return new BooleanOpenHashSet(set); } else if (oCls.equals(Character.class)) { return new CharOpenHashSet(set);
return new LongOpenHashSet(set); } else if (oCls.equals(Boolean.class)) { return new BooleanOpenHashSet(set); } else if (oCls.equals(Character.class)) { return new CharOpenHashSet(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(); }
public BooleanSet asSet() { BooleanSet set = new BooleanOpenHashSet(3); BooleanColumn unique = unique(); for (int i = 0; i < unique.size(); i++) { set.add((boolean) unique.get(i)); } return set; }
public BooleanSet asSet() { BooleanSet set = new BooleanOpenHashSet(3); BooleanColumn unique = unique(); for (int i = 0; i < unique.size(); i++) { set.add(unique.get(i)); } return 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(); }
@SuppressWarnings("unchecked") public static Set<?> toFastutilHashSet(Set<?> set, Type type, FunctionRegistry registry) { // 0.25 as the load factor is chosen because the argument set is assumed to be small (<10000), // and the return set is assumed to be read-heavy. // The performance of InCodeGenerator heavily depends on the load factor being small. Class<?> javaElementType = type.getJavaType(); if (javaElementType == long.class) { return new LongOpenCustomHashSet((Collection<Long>) set, 0.25f, new LongStrategy(registry, type)); } if (javaElementType == double.class) { return new DoubleOpenCustomHashSet((Collection<Double>) set, 0.25f, new DoubleStrategy(registry, type)); } if (javaElementType == boolean.class) { return new BooleanOpenHashSet((Collection<Boolean>) set, 0.25f); } else if (!type.getJavaType().isPrimitive()) { return new ObjectOpenCustomHashSet(set, 0.25f, new ObjectStrategy(registry, type)); } else { throw new UnsupportedOperationException("Unsupported native type in set: " + type.getJavaType() + " with type " + type.getTypeSignature()); } }
@SuppressWarnings({"unchecked"}) public static Set<?> toFastutilHashSet(Set<?> set, Type type, FunctionRegistry registry) { // 0.25 as the load factor is chosen because the argument set is assumed to be small (<10000), // and the return set is assumed to be read-heavy. // The performance of InCodeGenerator heavily depends on the load factor being small. Class<?> javaElementType = type.getJavaType(); if (javaElementType == long.class) { return new LongOpenCustomHashSet((Collection<Long>) set, 0.25f, new LongStrategy(registry, type)); } if (javaElementType == double.class) { return new DoubleOpenCustomHashSet((Collection<Double>) set, 0.25f, new DoubleStrategy(registry, type)); } if (javaElementType == boolean.class) { return new BooleanOpenHashSet((Collection<Boolean>) set, 0.25f); } else if (!type.getJavaType().isPrimitive()) { return new ObjectOpenCustomHashSet(set, 0.25f, new ObjectStrategy(registry, type)); } else { throw new UnsupportedOperationException("Unsupported native type in set: " + type.getJavaType() + " with type " + type.getTypeSignature()); } }
@SuppressWarnings("unchecked") public static Set<?> toFastutilHashSet(Set<?> set, Type type, FunctionRegistry registry) { // 0.25 as the load factor is chosen because the argument set is assumed to be small (<10000), // and the return set is assumed to be read-heavy. // The performance of InCodeGenerator heavily depends on the load factor being small. Class<?> javaElementType = type.getJavaType(); if (javaElementType == long.class) { return new LongOpenCustomHashSet((Collection<Long>) set, 0.25f, new LongStrategy(registry, type)); } if (javaElementType == double.class) { return new DoubleOpenCustomHashSet((Collection<Double>) set, 0.25f, new DoubleStrategy(registry, type)); } if (javaElementType == boolean.class) { return new BooleanOpenHashSet((Collection<Boolean>) set, 0.25f); } else if (!type.getJavaType().isPrimitive()) { return new ObjectOpenCustomHashSet(set, 0.25f, new ObjectStrategy(registry, type)); } else { throw new UnsupportedOperationException("Unsupported native type in set: " + type.getJavaType() + " with type " + type.getTypeSignature()); } }