/** Encode single integer dimension */ public static void encodeDimension(int value, byte dest[], int offset) { NumericUtils.intToSortableBytes(value, dest, offset); }
/** encode the given value into the byte array at the defined offset */ private static void encode(int val, byte[] bytes, int offset) { NumericUtils.intToSortableBytes(val, bytes, offset); }
/** sugar encodes a single point as a byte array */ private static byte[] encode(double latitude, double longitude) { byte[] bytes = new byte[2 * Integer.BYTES]; NumericUtils.intToSortableBytes(encodeLatitude(latitude), bytes, 0); NumericUtils.intToSortableBytes(encodeLongitude(longitude), bytes, Integer.BYTES); return bytes; }
/** sugar encodes a single point as a byte array, rounding values up */ private static byte[] encodeCeil(double latitude, double longitude) { byte[] bytes = new byte[2 * Integer.BYTES]; NumericUtils.intToSortableBytes(encodeLatitudeCeil(latitude), bytes, 0); NumericUtils.intToSortableBytes(encodeLongitudeCeil(longitude), bytes, Integer.BYTES); return bytes; }
/** Encode single float dimension */ public static void encodeDimension(float value, byte dest[], int offset) { NumericUtils.intToSortableBytes(NumericUtils.floatToSortableInt(value), dest, offset); }
/** encode the given value into the byte array at the defined offset */ private static void encode(float val, byte[] bytes, int offset) { NumericUtils.intToSortableBytes(NumericUtils.floatToSortableInt(val), bytes, offset); }
/** * Change the values of this field * @param latitude latitude value: must be within standard +/-90 coordinate bounds. * @param longitude longitude value: must be within standard +/-180 coordinate bounds. * @throws IllegalArgumentException if latitude or longitude are out of bounds */ public void setLocationValue(double latitude, double longitude) { final byte[] bytes; if (fieldsData == null) { bytes = new byte[8]; fieldsData = new BytesRef(bytes); } else { bytes = ((BytesRef) fieldsData).bytes; } int latitudeEncoded = encodeLatitude(latitude); int longitudeEncoded = encodeLongitude(longitude); NumericUtils.intToSortableBytes(latitudeEncoded, bytes, 0); NumericUtils.intToSortableBytes(longitudeEncoded, bytes, Integer.BYTES); }
final byte minLon[] = new byte[Integer.BYTES]; final byte maxLon[] = new byte[Integer.BYTES]; NumericUtils.intToSortableBytes(encodeLatitude(box.minLat), minLat, 0); NumericUtils.intToSortableBytes(encodeLatitude(box.maxLat), maxLat, 0); NumericUtils.intToSortableBytes(encodeLongitude(box.minLon), minLon, 0); NumericUtils.intToSortableBytes(encodeLongitude(box.maxLon), maxLon, 0);
NumericUtils.intToSortableBytes(encodeLatitude(box.minLat), minLat, 0); NumericUtils.intToSortableBytes(encodeLatitude(box.maxLat), maxLat, 0); NumericUtils.intToSortableBytes(Integer.MIN_VALUE, minLon, 0); NumericUtils.intToSortableBytes(encodeLongitude(box.maxLon), maxLon, 0); NumericUtils.intToSortableBytes(encodeLongitude(box.minLon), minLon2, 0); } else { NumericUtils.intToSortableBytes(encodeLongitude(box.minLon), minLon, 0); NumericUtils.intToSortableBytes(encodeLongitude(box.maxLon), maxLon, 0); NumericUtils.intToSortableBytes(Integer.MAX_VALUE, minLon2, 0);
/** * encodes a bounding box into the provided byte array */ private static void encode(final int minX, final int maxX, final int minY, final int maxY, byte[] b) { if (b == null) { b = new byte[4 * XLatLonShape.BYTES]; } NumericUtils.intToSortableBytes(minY, b, 0); NumericUtils.intToSortableBytes(minX, b, BYTES); NumericUtils.intToSortableBytes(maxY, b, 2 * BYTES); NumericUtils.intToSortableBytes(maxX, b, 3 * BYTES); }
NumericUtils.intToSortableBytes(Integer.MIN_VALUE, leftOpen, Integer.BYTES); Query left = newBoxInternal(field, leftOpen, upper); q.add(new BooleanClause(left, BooleanClause.Occur.SHOULD)); NumericUtils.intToSortableBytes(Integer.MAX_VALUE, rightOpen, Integer.BYTES); Query right = newBoxInternal(field, lower, rightOpen); q.add(new BooleanClause(right, BooleanClause.Occur.SHOULD));
static byte[] encodeFloat(float number) { byte[] encoded = new byte[4]; NumericUtils.intToSortableBytes(NumericUtils.floatToSortableInt(number), encoded, 0); return encoded; }
throw new IllegalArgumentException("Could not encode the provided triangle"); NumericUtils.intToSortableBytes(minY, bytes, 0); NumericUtils.intToSortableBytes(minX, bytes, BYTES); NumericUtils.intToSortableBytes(maxY, bytes, 2 * BYTES); NumericUtils.intToSortableBytes(maxX, bytes, 3 * BYTES); NumericUtils.intToSortableBytes(y, bytes, 4 * BYTES); NumericUtils.intToSortableBytes(x, bytes, 5 * BYTES); NumericUtils.intToSortableBytes(bits, bytes, 6 * BYTES);
/** Encode single integer dimension */ public static void encodeDimension(int value, byte dest[], int offset) { NumericUtils.intToSortableBytes(value, dest, offset); }
/** encodes a two-dimensional geopoint (lat, lon) into a byte array */ static void encode(double lat, double lon, byte[] result, int offset) { if (result == null) { result = new byte[BYTES*4]; } NumericUtils.intToSortableBytes(encodeLatitude(lat), result, offset); NumericUtils.intToSortableBytes(encodeLongitude(lon), result, offset + BYTES); }
public static BytesRef fromInteger(int value) { final BytesRef bytesRef = new BytesRef(new byte[4]); NumericUtils.intToSortableBytes(value, bytesRef.bytes, 0); return bytesRef; }
/** encode the given value into the byte array at the defined offset */ private static void encode(float val, byte[] bytes, int offset) { NumericUtils.intToSortableBytes(NumericUtils.floatToSortableInt(val), bytes, offset); }
/** sugar encodes a single point as a byte array, rounding values up */ private static byte[] encodeCeil(double latitude, double longitude) { byte[] bytes = new byte[2 * Integer.BYTES]; NumericUtils.intToSortableBytes(encodeLatitudeCeil(latitude), bytes, 0); NumericUtils.intToSortableBytes(encodeLongitudeCeil(longitude), bytes, Integer.BYTES); return bytes; }
static byte[] encodeFloat(float number) { byte[] encoded = new byte[4]; NumericUtils.intToSortableBytes(NumericUtils.floatToSortableInt(number), encoded, 0); return encoded; }
public static BytesRef fromFloat(float value) { final BytesRef bytesRef = new BytesRef(new byte[4]); NumericUtils.intToSortableBytes(NumericUtils.floatToSortableInt(value), bytesRef.bytes, 0); return bytesRef; }