public RunLengthEncodedBlockCursor(RandomAccessBlock value, int positionCount) { this.value = checkNotNull(value, "value is null"); checkArgument( value.getPositionCount() == 1, "Expected value to contain a single position but has %s positions", value.getPositionCount()); checkArgument(positionCount >= 0, "positionCount is negative"); this.positionCount = positionCount; position = -1; }
@Override public Type getType() { return value.getType(); }
@Override public int calculateHashCode() { return value.hashCode(0); }
@Override public void appendTo(BlockBuilder blockBuilder) { value.appendTo(0, blockBuilder); }
@Override public boolean isNull() { checkReadablePosition(); return value.isNull(0); }
@Override public int compareTo(Slice slice, int offset) { checkReadablePosition(); return value.compareTo(0, slice, offset); }
@Override public Object getObjectValue(Session session) { checkReadablePosition(); return value.getObjectValue(session, 0); }
@Override public Slice getSlice() { checkReadablePosition(); return value.getSlice(0); }
@Override public double getDouble() { checkReadablePosition(); return value.getDouble(0); }
@Override public long getLong() { checkReadablePosition(); return value.getLong(0); }
@Override public boolean getBoolean() { checkReadablePosition(); return value.getBoolean(0); }