Package org.apache.lucene.geo
Class XYEncodingUtils
- java.lang.Object
-
- org.apache.lucene.geo.XYEncodingUtils
-
public final class XYEncodingUtils extends java.lang.Objectreusable cartesian geometry encoding methods
-
-
Field Summary
Fields Modifier and Type Field Description static doubleMAX_VAL_INCLstatic doubleMIN_VAL_INCL
-
Constructor Summary
Constructors Modifier Constructor Description privateXYEncodingUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description (package private) static floatcheckVal(float x)validates value is a number and finitestatic floatdecode(byte[] src, int offset)Turns quantized value from byte array back into a double.static floatdecode(int encoded)Turns quantized value fromencode(float)back into a double.static intencode(float x)Quantizes double (64 bit) values into 32 bits(package private) static double[]floatArrayToDoubleArray(float[] f)
-
-
-
Field Detail
-
MIN_VAL_INCL
public static final double MIN_VAL_INCL
- See Also:
- Constant Field Values
-
MAX_VAL_INCL
public static final double MAX_VAL_INCL
- See Also:
- Constant Field Values
-
-
Method Detail
-
checkVal
static float checkVal(float x)
validates value is a number and finite
-
encode
public static int encode(float x)
Quantizes double (64 bit) values into 32 bits- Parameters:
x- cartesian value- Returns:
- encoded value as a 32-bit
int - Throws:
java.lang.IllegalArgumentException- if value is out of bounds
-
decode
public static float decode(int encoded)
Turns quantized value fromencode(float)back into a double.- Parameters:
encoded- encoded value: 32-bit quantized value.- Returns:
- decoded value value.
-
decode
public static float decode(byte[] src, int offset)Turns quantized value from byte array back into a double.- Parameters:
src- byte array containing 4 bytes to decode atoffsetoffset- offset intosrcto decode from.- Returns:
- decoded value.
-
floatArrayToDoubleArray
static double[] floatArrayToDoubleArray(float[] f)
-
-