private void checkReadablePosition(int position) { if (position < 0 || position >= getPositionCount()) { throw new IllegalArgumentException("position is not valid"); } } }
@Override public String toString() { StringBuilder sb = new StringBuilder("IntArrayBlockBuilder{"); sb.append("positionCount=").append(getPositionCount()); sb.append('}'); return sb.toString(); }
@Override public Block copyRegion(int positionOffset, int length) { checkValidRegion(getPositionCount(), positionOffset, length); if (!hasNonNullValue) { return new RunLengthEncodedBlock(NULL_VALUE_BLOCK, length); } boolean[] newValueIsNull = null; if (hasNullValue) { newValueIsNull = Arrays.copyOfRange(valueIsNull, positionOffset, positionOffset + length); } int[] newValues = Arrays.copyOfRange(values, positionOffset, positionOffset + length); return new IntArrayBlock(0, length, newValueIsNull, newValues); }
@Override public Block getRegion(int positionOffset, int length) { checkValidRegion(getPositionCount(), positionOffset, length); if (!hasNonNullValue) { return new RunLengthEncodedBlock(NULL_VALUE_BLOCK, length); } return new IntArrayBlock(positionOffset, length, hasNullValue ? valueIsNull : null, values); }
private void checkReadablePosition(int position) { if (position < 0 || position >= getPositionCount()) { throw new IllegalArgumentException("position is not valid"); } } }
@Override public String toString() { StringBuilder sb = new StringBuilder("IntArrayBlockBuilder{"); sb.append("positionCount=").append(getPositionCount()); sb.append('}'); return sb.toString(); }
@Override public Block copyRegion(int positionOffset, int length) { checkValidRegion(getPositionCount(), positionOffset, length); if (!hasNonNullValue) { return new RunLengthEncodedBlock(NULL_VALUE_BLOCK, length); } boolean[] newValueIsNull = null; if (hasNullValue) { newValueIsNull = Arrays.copyOfRange(valueIsNull, positionOffset, positionOffset + length); } int[] newValues = Arrays.copyOfRange(values, positionOffset, positionOffset + length); return new IntArrayBlock(0, length, newValueIsNull, newValues); }
@Override public Block getRegion(int positionOffset, int length) { checkValidRegion(getPositionCount(), positionOffset, length); if (!hasNonNullValue) { return new RunLengthEncodedBlock(NULL_VALUE_BLOCK, length); } return new IntArrayBlock(positionOffset, length, hasNullValue ? valueIsNull : null, values); }