public static byte[] toByteArray(long value) { byte[] bytes = new byte[Long.BYTES]; setLong(bytes, 0, value); return bytes; } }
public static void setDayTime(byte[] bytes, int start, long value) { LongPointable.setLong(bytes, start + DAY_TIME_OFFSET, value); }
public static void setDouble(byte[] bytes, int start, double value) { long bits = Double.doubleToLongBits(value); LongPointable.setLong(bytes, start, bits); }
public long postIncrement() { long v = getLong(); long ov = v++; setLong(v); return ov; }
public long preIncrement() { long v = getLong(); ++v; setLong(v); return v; }
public LongPointable createPointable(long value) { LongPointable pointable = new LongPointable(); pointable.setLong(value); return pointable; }
public void setLong(long value) { if (bytes == null) { start = 0; length = TYPE_TRAITS.getFixedLength(); bytes = new byte[length]; } setLong(bytes, start, value); }
public void setDecimal(long value, byte decimalPlace) { BytePointable.setByte(bytes, start + DECIMAL_PLACE_OFFSET, decimalPlace); LongPointable.setLong(bytes, start + VALUE_OFFSET, value); normalize(); }
@Override public void after(long lsn) { pointable.setLong(lsn); try { index.getCurrentMemoryComponent().getMetadata().put(ComponentUtils.MARKER_LSN_KEY, pointable); } catch (HyracksDataException e) { throw new IllegalStateException(e); } }
public static void normalize(byte[] bytes, int start) { byte decimalPlace = getDecimalPlace(bytes, start); long value = getDecimalValue(bytes, start); // Normalize the value and take off trailing zeros. while (value != 0 && value % 10 == 0) { value /= 10; --decimalPlace; } BytePointable.setByte(bytes, start + DECIMAL_PLACE_OFFSET, decimalPlace); LongPointable.setLong(bytes, start + VALUE_OFFSET, value); }
LongPointable.setLong(integerResult, 1, compareTo); result.set(integerResult, 0, LongPointable.TYPE_TRAITS.getFixedLength() + 1);
int space = frame.getSpace() - (value.getLength() + Integer.BYTES * 2 + testKey.getLength()); for (long l = 1L; l < 52L; l++) { LongPointable.setLong(longBytes, 0, l); frame.put(testKey, value); Assert.assertEquals(space, frame.getSpace());