@Override public boolean isNull(int position) { checkReadablePosition(position); return valueIsNull != null && valueIsNull[position + arrayOffset]; }
@Override public int getInt(int position, int offset) { checkReadablePosition(position); if (offset != 0) { throw new IllegalArgumentException("offset must be zero"); } return values[position + arrayOffset]; }
@Override public void writePositionTo(int position, BlockBuilder blockBuilder) { checkReadablePosition(position); blockBuilder.writeInt(values[position + arrayOffset]); blockBuilder.closeEntry(); }
@Override public Block getSingleValueBlock(int position) { checkReadablePosition(position); return new IntArrayBlock( 0, 1, isNull(position) ? new boolean[] {true} : null, new int[] {values[position + arrayOffset]}); }
@Override public Block copyPositions(int[] positions, int offset, int length) { checkArrayRange(positions, offset, length); boolean[] newValueIsNull = null; if (valueIsNull != null) { newValueIsNull = new boolean[length]; } int[] newValues = new int[length]; for (int i = 0; i < length; i++) { int position = positions[offset + i]; checkReadablePosition(position); if (valueIsNull != null) { newValueIsNull[i] = valueIsNull[position + arrayOffset]; } newValues[i] = values[position + arrayOffset]; } return new IntArrayBlock(0, length, newValueIsNull, newValues); }
@Override public boolean isNull(int position) { checkReadablePosition(position); return valueIsNull != null && valueIsNull[position + arrayOffset]; }
@Override public int getInt(int position, int offset) { checkReadablePosition(position); if (offset != 0) { throw new IllegalArgumentException("offset must be zero"); } return values[position + arrayOffset]; }
@Override public Block getSingleValueBlock(int position) { checkReadablePosition(position); return new IntArrayBlock( 0, 1, isNull(position) ? new boolean[] {true} : null, new int[] {values[position + arrayOffset]}); }
@Override public void writePositionTo(int position, BlockBuilder blockBuilder) { checkReadablePosition(position); blockBuilder.writeInt(values[position + arrayOffset]); blockBuilder.closeEntry(); }
@Override public Block copyPositions(int[] positions, int offset, int length) { checkArrayRange(positions, offset, length); boolean[] newValueIsNull = null; if (valueIsNull != null) { newValueIsNull = new boolean[length]; } int[] newValues = new int[length]; for (int i = 0; i < length; i++) { int position = positions[offset + i]; checkReadablePosition(position); if (valueIsNull != null) { newValueIsNull[i] = valueIsNull[position + arrayOffset]; } newValues[i] = values[position + arrayOffset]; } return new IntArrayBlock(0, length, newValueIsNull, newValues); }