/** Encode single long dimension */ public static void encodeDimension(long value, byte dest[], int offset) { NumericUtils.longToSortableBytes(value, dest, offset); }
/** encode the given value into the byte array at the defined offset */ private static void encode(long val, byte[] bytes, int offset) { NumericUtils.longToSortableBytes(val, bytes, offset); }
/** Encode single double dimension */ public static void encodeDimension(double value, byte dest[], int offset) { NumericUtils.longToSortableBytes(NumericUtils.doubleToSortableLong(value), dest, offset); }
/** encode the given value into the byte array at the defined offset */ private static void encode(double val, byte[] bytes, int offset) { NumericUtils.longToSortableBytes(NumericUtils.doubleToSortableLong(val), bytes, offset); }
static byte[] encodeDouble(double number) { byte[] encoded = new byte[8]; NumericUtils.longToSortableBytes(NumericUtils.doubleToSortableLong(number), encoded, 0); return encoded; }
/** encodes bounding box value of triangle. Note the encoding uses 64bit encoding, but the bounding box only needs * 32bits, so we pad w/ zeros to take advantage of prefix compression. */ public static void encodeTriangleBoxVal(int encodedVal, byte[] bytes, int offset) { long val = (long)(encodedVal ^ 0x80000000); val &= 0x00000000FFFFFFFFL; val ^= 0x8000000000000000L; NumericUtils.longToSortableBytes(val, bytes, offset); }
/** encode the given value into the byte array at the defined offset */ private static void encode(long val, byte[] bytes, int offset) { NumericUtils.longToSortableBytes(val, bytes, offset); }
/** Encode single long dimension */ public static void encodeDimension(long value, byte dest[], int offset) { NumericUtils.longToSortableBytes(value, dest, offset); }
static byte[] encodeDouble(double number) { byte[] encoded = new byte[8]; NumericUtils.longToSortableBytes(NumericUtils.doubleToSortableLong(number), encoded, 0); return encoded; }
static byte[] encodeDouble(double number) { byte[] encoded = new byte[8]; NumericUtils.longToSortableBytes(NumericUtils.doubleToSortableLong(number), encoded, 0); return encoded; }
static byte[] encodeDouble(double number) { byte[] encoded = new byte[8]; NumericUtils.longToSortableBytes(NumericUtils.doubleToSortableLong(number), encoded, 0); return encoded; }
public static BytesRef fromLong(long value) { final BytesRef bytesRef = new BytesRef(new byte[8]); NumericUtils.longToSortableBytes(value, bytesRef.bytes, 0); return bytesRef; }
/** Encode single double dimension */ public static void encodeDimension(double value, byte dest[], int offset) { NumericUtils.longToSortableBytes(NumericUtils.doubleToSortableLong(value), dest, offset); }
/** encode the given value into the byte array at the defined offset */ private static void encode(double val, byte[] bytes, int offset) { NumericUtils.longToSortableBytes(NumericUtils.doubleToSortableLong(val), bytes, offset); }
private void encodeTriangle(byte[] bytes, int minY, int minX, int maxY, int maxX, int aX, int aY, int bX, int bY, int cX, int cY) { encodeTriangleBoxVal(minY, bytes, 0); encodeTriangleBoxVal(minX, bytes, BYTES); encodeTriangleBoxVal(maxY, bytes, 2 * BYTES); encodeTriangleBoxVal(maxX, bytes, 3 * BYTES); long a = (((long)aX) << 32) | (((long)aY) & 0x00000000FFFFFFFFL); long b = (((long)bX) << 32) | (((long)bY) & 0x00000000FFFFFFFFL); long c = (((long)cX) << 32) | (((long)cY) & 0x00000000FFFFFFFFL); NumericUtils.longToSortableBytes(a, bytes, 4 * BYTES); NumericUtils.longToSortableBytes(b, bytes, 5 * BYTES); NumericUtils.longToSortableBytes(c, bytes, 6 * BYTES); } }
public static BytesRef fromDouble(double value) { final BytesRef bytesRef = new BytesRef(new byte[8]); NumericUtils.longToSortableBytes(NumericUtils.doubleToSortableLong(value), bytesRef.bytes, 0); return bytesRef; }