private ColumnChunk readMap(GroupField field) throws IOException { List<Type> parameters = field.getType().getTypeParameters(); checkArgument(parameters.size() == 2, "Maps must have two type parameters, found %d", parameters.size()); Block[] blocks = new Block[parameters.size()]; ColumnChunk columnChunk = readColumnChunk(field.getChildren().get(0).get()); blocks[0] = columnChunk.getBlock(); blocks[1] = readColumnChunk(field.getChildren().get(1).get()).getBlock(); IntList offsets = new IntArrayList(); BooleanList valueIsNull = new BooleanArrayList(); calculateCollectionOffsets(field, offsets, valueIsNull, columnChunk.getDefinitionLevels(), columnChunk.getRepetitionLevels()); Block mapBlock = ((MapType) field.getType()).createBlockFromKeyValue(Optional.of(valueIsNull.toBooleanArray()), offsets.toIntArray(), blocks[0], blocks[1]); return new ColumnChunk(mapBlock, columnChunk.getDefinitionLevels(), columnChunk.getRepetitionLevels()); }
private ColumnChunk readArray(GroupField field) throws IOException { List<Type> parameters = field.getType().getTypeParameters(); checkArgument(parameters.size() == 1, "Arrays must have a single type parameter, found %d", parameters.size()); Field elementField = field.getChildren().get(0).get(); ColumnChunk columnChunk = readColumnChunk(elementField); IntList offsets = new IntArrayList(); BooleanList valueIsNull = new BooleanArrayList(); calculateCollectionOffsets(field, offsets, valueIsNull, columnChunk.getDefinitionLevels(), columnChunk.getRepetitionLevels()); Block arrayBlock = ArrayBlock.fromElementBlock(valueIsNull.size(), Optional.of(valueIsNull.toBooleanArray()), offsets.toIntArray(), columnChunk.getBlock()); return new ColumnChunk(arrayBlock, columnChunk.getDefinitionLevels(), columnChunk.getRepetitionLevels()); }
BooleanList structIsNull = new BooleanArrayList(); boolean required = field.isRequired(); if (fieldDefinitionLevels == null) {
outputStream.reset(); BooleanList expectedValues = new BooleanArrayList(1024); outputStream.writeBooleans(32, true); expectedValues.addAll(Collections.nCopies(32, true));
protected BooleanListBitVector( final int capacity ) { this( new BooleanArrayList( capacity ) ); }
protected BooleanListBitVector( final int capacity ) { this( new BooleanArrayList( capacity ) ); }
@Override public BooleanArrayList clone() { BooleanArrayList c = new BooleanArrayList(size); System.arraycopy(a, 0, c.a, 0, size); c.size = size; return c; } /**
public BitVector copy() { return new BooleanListBitVector( new BooleanArrayList( list ) ); }
public BitVector copy() { return new BooleanListBitVector( new BooleanArrayList( list ) ); }
/** * Wraps a given array into an array list of given size. * * <p> * Note it is guaranteed that the type of the array returned by * {@link #elements()} will be the same (see the comments in the class * documentation). * * @param a * an array to wrap. * @param length * the length of the resulting array list. * @return a new array list of the given size, wrapping the given array. */ public static BooleanArrayList wrap(final boolean a[], final int length) { if (length > a.length) throw new IllegalArgumentException( "The specified length (" + length + ") is greater than the array size (" + a.length + ")"); final BooleanArrayList l = new BooleanArrayList(a, false); l.size = length; return l; } /**
wrapped = new BooleanArrayList(2); wrapped.add(key[pos]);
/** * Pours an iterator, returning a type-specific list, with a limit on the number * of elements. * * <p> * This method iterates over the given type-specific iterator and returns a * type-specific list containing the returned elements (up to {@code max}). * Iteration on the returned list is guaranteed to produce the elements in the * same order in which they appeared in the iterator. * * * @param i * a type-specific iterator. * @param max * the maximum number of elements to be poured. * @return a type-specific list containing the returned elements, up to * {@code max}. */ public static BooleanList pour(final BooleanIterator i, int max) { final BooleanArrayList l = new BooleanArrayList(); pour(i, l, max); l.trim(); return l; } /**
private List deserializeList(final DataInput is) throws IOException, ClassNotFoundException { Object h = deserialize(is); Class oCls = h.getClass(); if (oCls.equals(Integer.class)) { int size = (Integer) h; ObjectArrayList list = new ObjectArrayList(size); for (int i = 0; i < size; i++) { list.add(deserialize(is)); } return list; } else if (oCls.equals(int[].class)) { return new IntArrayList((int[]) h); } else if (oCls.equals(float[].class)) { return new FloatArrayList((float[]) h); } else if (oCls.equals(double[].class)) { return new DoubleArrayList((double[]) h); } else if (oCls.equals(short[].class)) { return new ShortArrayList((short[]) h); } else if (oCls.equals(byte[].class)) { return new ByteArrayList((byte[]) h); } else if (oCls.equals(long[].class)) { return new LongArrayList((long[]) h); } else if (oCls.equals(boolean[].class)) { return new BooleanArrayList((boolean[]) h); } else if (oCls.equals(char[].class)) { return new CharArrayList((char[]) h); } throw new EOFException(); }
private List deserializeList(final DataInput is) throws IOException, ClassNotFoundException { Object h = deserialize(is); Class oCls = h.getClass(); if (oCls.equals(Integer.class)) { int size = (Integer) h; ObjectArrayList list = new ObjectArrayList(size); for (int i = 0; i < size; i++) { list.add(deserialize(is)); } return list; } else if (oCls.equals(int[].class)) { return new IntArrayList((int[]) h); } else if (oCls.equals(float[].class)) { return new FloatArrayList((float[]) h); } else if (oCls.equals(double[].class)) { return new DoubleArrayList((double[]) h); } else if (oCls.equals(short[].class)) { return new ShortArrayList((short[]) h); } else if (oCls.equals(byte[].class)) { return new ByteArrayList((byte[]) h); } else if (oCls.equals(long[].class)) { return new LongArrayList((long[]) h); } else if (oCls.equals(boolean[].class)) { return new BooleanArrayList((boolean[]) h); } else if (oCls.equals(char[].class)) { return new CharArrayList((char[]) h); } throw new EOFException(); }
private ColumnChunk readMap(GroupField field) throws IOException { List<Type> parameters = field.getType().getTypeParameters(); checkArgument(parameters.size() == 2, "Maps must have two type parameters, found %d", parameters.size()); Block[] blocks = new Block[parameters.size()]; ColumnChunk columnChunk = readColumnChunk(field.getChildren().get(0).get()); blocks[0] = columnChunk.getBlock(); blocks[1] = readColumnChunk(field.getChildren().get(1).get()).getBlock(); IntList offsets = new IntArrayList(); BooleanList valueIsNull = new BooleanArrayList(); calculateCollectionOffsets(field, offsets, valueIsNull, columnChunk.getDefinitionLevels(), columnChunk.getRepetitionLevels()); Block mapBlock = ((MapType) field.getType()).createBlockFromKeyValue(Optional.of(valueIsNull.toBooleanArray()), offsets.toIntArray(), blocks[0], blocks[1]); return new ColumnChunk(mapBlock, columnChunk.getDefinitionLevels(), columnChunk.getRepetitionLevels()); }
private void readObject(final ObjectInputStream s) throws IOException, ClassNotFoundException { s.defaultReadObject(); initHeadTail(); handle2Node = new Handle2NodeMap<>(size, transform); if (size > 0) root = readNode(s, 0, 0, handle2Node, new ObjectArrayList<Leaf<T>>(), new ObjectArrayList<InternalNode<T>>(), new IntArrayList(), new IntArrayList(), new BooleanArrayList()); if (ASSERTS) assertTrie(); }
private ColumnChunk readMap(GroupField field) throws IOException { List<Type> parameters = field.getType().getTypeParameters(); checkArgument(parameters.size() == 2, "Maps must have two type parameters, found %d", parameters.size()); Block[] blocks = new Block[parameters.size()]; ColumnChunk columnChunk = readColumnChunk(field.getChildren().get(0).get()); blocks[0] = columnChunk.getBlock(); blocks[1] = readColumnChunk(field.getChildren().get(1).get()).getBlock(); IntList offsets = new IntArrayList(); BooleanList valueIsNull = new BooleanArrayList(); calculateCollectionOffsets(field, offsets, valueIsNull, columnChunk.getDefinitionLevels(), columnChunk.getRepetitionLevels()); Block mapBlock = ((MapType) field.getType()).createBlockFromKeyValue(Optional.of(valueIsNull.toBooleanArray()), offsets.toIntArray(), blocks[0], blocks[1]); return new ColumnChunk(mapBlock, columnChunk.getDefinitionLevels(), columnChunk.getRepetitionLevels()); }
private ColumnChunk readArray(GroupField field) throws IOException { List<Type> parameters = field.getType().getTypeParameters(); checkArgument(parameters.size() == 1, "Arrays must have a single type parameter, found %d", parameters.size()); Field elementField = field.getChildren().get(0).get(); ColumnChunk columnChunk = readColumnChunk(elementField); IntList offsets = new IntArrayList(); BooleanList valueIsNull = new BooleanArrayList(); calculateCollectionOffsets(field, offsets, valueIsNull, columnChunk.getDefinitionLevels(), columnChunk.getRepetitionLevels()); Block arrayBlock = ArrayBlock.fromElementBlock(valueIsNull.size(), Optional.of(valueIsNull.toBooleanArray()), offsets.toIntArray(), columnChunk.getBlock()); return new ColumnChunk(arrayBlock, columnChunk.getDefinitionLevels(), columnChunk.getRepetitionLevels()); }
private ColumnChunk readArray(GroupField field) throws IOException { List<Type> parameters = field.getType().getTypeParameters(); checkArgument(parameters.size() == 1, "Arrays must have a single type parameter, found %d", parameters.size()); Field elementField = field.getChildren().get(0).get(); ColumnChunk columnChunk = readColumnChunk(elementField); IntList offsets = new IntArrayList(); BooleanList valueIsNull = new BooleanArrayList(); calculateCollectionOffsets(field, offsets, valueIsNull, columnChunk.getDefinitionLevels(), columnChunk.getRepetitionLevels()); Block arrayBlock = ArrayBlock.fromElementBlock(valueIsNull.size(), Optional.of(valueIsNull.toBooleanArray()), offsets.toIntArray(), columnChunk.getBlock()); return new ColumnChunk(arrayBlock, columnChunk.getDefinitionLevels(), columnChunk.getRepetitionLevels()); }
BooleanList structIsNull = new BooleanArrayList(); boolean required = field.isRequired(); if (fieldDefinitionLevels == null) {