@Override public int hash() { long v = getLong(); return (int) (v ^ (v >>> 32)); }
public LongPointable createPointable(long value) { LongPointable pointable = new LongPointable(); pointable.setLong(value); return pointable; }
@Override public void operateInteger(LongPointable longp, DataOutput dOut) throws SystemException, IOException { dOut.write(ValueTag.XS_INTEGER_TAG); dOut.write(longp.getByteArray(), longp.getStartOffset(), longp.getLength()); } }
@Override public void operateDTDurationInteger(LongPointable longp1, LongPointable longp2, DataOutput dOut) throws SystemException, IOException { if (longp2.getLong() == 0) { throw new SystemException(ErrorCode.FODT0002); } long value = longp1.longValue(); value /= longp2.longValue(); dOut.write(ValueTag.XS_DAY_TIME_DURATION_TAG); dOut.writeLong(value); }
public static byte[] toByteArray(long value) { byte[] bytes = new byte[Long.BYTES]; setLong(bytes, 0, value); return bytes; } }
LongPointable longPointable = (LongPointable) LongPointable.FACTORY.createPointable(); frame.get(testKey, longPointable); Assert.assertNull(longPointable.getByteArray()); byte[] longBytes = new byte[Long.BYTES]; MutableArrayValueReference value = new MutableArrayValueReference(longBytes); 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()); frame.get(testKey, longPointable); Assert.assertEquals(l, longPointable.longValue());
@Override public void operateYMDurationInteger(IntegerPointable intp, LongPointable longp, DataOutput dOut) throws SystemException, IOException { if (longp.getLong() == 0) { throw new SystemException(ErrorCode.FOAR0001); } int value = intp.intValue(); value /= longp.intValue(); dOut.write(ValueTag.XS_YEAR_MONTH_DURATION_TAG); dOut.writeInt(value); }
@Override public void operateDoubleInteger(DoublePointable doublep, LongPointable longp, DataOutput dOut) throws SystemException, IOException { if (longp.getLong() == 0) { throw new SystemException(ErrorCode.FOAR0001); } double value = doublep.doubleValue(); value /= longp.doubleValue(); dOut.write(ValueTag.XS_DOUBLE_TAG); dOut.writeDouble(value); }
@Override public void operateFloatInteger(FloatPointable floatp1, LongPointable longp2, DataOutput dOut) throws SystemException, IOException { if (longp2.getLong() == 0) { throw new SystemException(ErrorCode.FOAR0001); } float value = floatp1.floatValue(); value /= longp2.floatValue(); dOut.write(ValueTag.XS_FLOAT_TAG); dOut.writeFloat(value); }
public static long getTreeIndexLSN(DiskComponentMetadata md) throws HyracksDataException { LongPointable pointable = new LongPointable(); IMetadataPageManager metadataPageManager = md.getMetadataPageManager(); metadataPageManager.get(metadataPageManager.createMetadataFrame(), KEY_METADATA_FLUSH_LOG_LSN, pointable); return pointable.getLength() == 0 ? INVALID_LSN : pointable.longValue(); }
@Override public boolean operateIntegerInteger(LongPointable longp1, LongPointable longp2) throws SystemException, IOException { return (longp1.compareTo(longp2) == 0); }
@Override public LongPointable createPointable() { return new LongPointable(); }
@Override public void operateDecimalInteger(XSDecimalPointable decp1, LongPointable longp2, DataOutput dOut) throws SystemException, IOException { if (longp2.getLong() == 0) { throw new SystemException(ErrorCode.FOAR0001); } // Convert abvsInner.reset(); decp2.set(abvsInner.getByteArray(), abvsInner.getStartOffset(), XSDecimalPointable.TYPE_TRAITS.getFixedLength()); decp2.setDecimal(longp2.longValue(), (byte) 0); operateDecimalDecimal(decp1, decp2, dOut); }
public static void setDayTime(byte[] bytes, int start, long value) { LongPointable.setLong(bytes, start + DAY_TIME_OFFSET, value); }
@Override public void convertDTDuration(LongPointable longp, DataOutput dOut) throws SystemException, IOException { dOut.write(ValueTag.XS_DAY_TIME_DURATION_TAG); dOut.write(longp.getByteArray(), longp.getStartOffset(), longp.getLength()); }
@Override public boolean operateDTDurationDTDuration(LongPointable longp1, LongPointable longp2) throws SystemException, IOException { return (longp1.compareTo(longp2) == 0); }
@Override public float floatValue() { return getLong(); }