org.apache.lucene.document
public class NumberTools extends Object
That is, if l1 is less than l2 for any two longs l1 and l2, then NumberTools.longToString(l1) is lexicographically less than NumberTools.longToString(l2). (Similarly for "greater than" and "equals".)
This class handles all long values (unlike DateField).
Field Summary | |
---|---|
static String | MAX_STRING_VALUE
Equivalent to longToString(Long.MAX_VALUE) |
static String | MIN_STRING_VALUE
Equivalent to longToString(Long.MIN_VALUE) |
static int | STR_SIZE
The length of (all) strings returned by |
Method Summary | |
---|---|
static String | longToString(long l)
Converts a long to a String suitable for indexing. |
static long | stringToLong(String str)
Converts a String that was returned by NumberTools back to a
long.
|
Throws: IllegalArgumentException if the input is null NumberFormatException if the input does not parse (it was not a String returned by longToString()).