Documentation of 'org.apache.lucene.document.NumberTools' Java class
NumberTools
org.apache.lucene.document

Class NumberTools



  • public class NumberTools
    extends java.lang.Object
    Provides support for converting longs to Strings, and back again. The strings are structured so that lexicographic sorting order is preserved.

    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

      Fields 
      Modifier and Type Field and Description
      static java.lang.String MAX_STRING_VALUE
      Equivalent to longToString(Long.MAX_VALUE)
      static java.lang.String MIN_STRING_VALUE
      Equivalent to longToString(Long.MIN_VALUE)
      static int STR_SIZE
      The length of (all) strings returned by longToString(long)
    • Constructor Summary

      Constructors 
      Constructor and Description
      NumberTools() 
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method and Description
      static java.lang.String longToString(long l)
      Converts a long to a String suitable for indexing.
      static long stringToLong(java.lang.String str)
      Converts a String that was returned by longToString(long) back to a long.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • MIN_STRING_VALUE

        public static final java.lang.String MIN_STRING_VALUE
        Equivalent to longToString(Long.MIN_VALUE)
        See Also:
        Constant Field Values
      • MAX_STRING_VALUE

        public static final java.lang.String MAX_STRING_VALUE
        Equivalent to longToString(Long.MAX_VALUE)
        See Also:
        Constant Field Values
      • STR_SIZE

        public static final int STR_SIZE
        The length of (all) strings returned by longToString(long)
    • Constructor Detail

      • NumberTools

        public NumberTools()
    • Method Detail

      • longToString

        public static java.lang.String longToString(long l)
        Converts a long to a String suitable for indexing.
      • stringToLong

        public static long stringToLong(java.lang.String str)
        Converts a String that was returned by longToString(long) back to a long.
        Throws:
        java.lang.IllegalArgumentException - if the input is null
        java.lang.NumberFormatException - if the input does not parse (it was not a String returned by longToString()).

DataMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.