public Object freeze(ColumnLoader.ValueSet valueSet) { final int chunksPerWord = 64 / bitCount; final List<Comparable> valueList = valueSet.values; final int valueCount = valueList.size(); final int wordCount = (valueCount + (chunksPerWord - 1)) / chunksPerWord; final int remainingChunkCount = valueCount % chunksPerWord; final long[] longs = new long[wordCount]; final int n = valueCount / chunksPerWord; int i; int k = 0; if (valueCount > 0 && valueList.get(0) instanceof Boolean) { @SuppressWarnings("unchecked") final List<Boolean> booleans = (List) valueSet.values; for (i = 0; i < n; i++) { long v = 0; for (int j = 0; j < chunksPerWord; j++) { v |= (booleans.get(k++) ? (1 << (bitCount * j)) : 0); } longs[i] = v; } if (remainingChunkCount > 0) { long v = 0; for (int j = 0; j < remainingChunkCount; j++) { v |= (booleans.get(k++) ? (1 << (bitCount * j)) : 0); } longs[i] = v; } } else { @SuppressWarnings("unchecked") final List<Number> numbers = (List) valueSet.values; for (i = 0; i < n; i++) { long v = 0; for (int j = 0; j < chunksPerWord; j++) { v |= (numbers.get(k++).longValue() << (bitCount * j)); } longs[i] = v; } if (remainingChunkCount > 0) { long v = 0; for (int j = 0; j < remainingChunkCount; j++) { v |= (numbers.get(k++).longValue() << (bitCount * j)); } longs[i] = v; } } return longs; }
public Statistic getStatistic() { return Statistics.of(list.size(), Collections.<BitSet>emptyList()); }