Class ParseUtils


  • @Deprecated
    public class ParseUtils
    extends Object
    Deprecated.
    Not useful; see https://github.com/spatial4j/spatial4j/issues/19
    Utility methods related to parsing a series of numbers.

    This code came from DistanceUtils, which came from Apache Lucene, LUCENE-773, which in turn came from "LocalLucene".

    • Method Detail

      • parsePoint

        public static String[] parsePoint​(String[] out,
                                          String externalVal,
                                          int dimension)
                                   throws InvalidShapeException
        Deprecated.
        Given a string containing dimension values encoded in it, separated by commas, return a String array of length dimension containing the values.
        Parameters:
        out - A preallocated array. Must be size dimension. If it is not it will be resized.
        externalVal - The value to parse
        dimension - The expected number of values for the point
        Returns:
        An array of the values that make up the point (aka vector)
        Throws:
        InvalidShapeException - if the dimension specified does not match the number of values in the externalValue.
      • parsePointDouble

        public static double[] parsePointDouble​(double[] out,
                                                String externalVal,
                                                int dimension)
                                         throws InvalidShapeException
        Deprecated.
        Given a string containing dimension values encoded in it, separated by commas, return a double array of length dimension containing the values.
        Parameters:
        out - A preallocated array. Must be size dimension. If it is not it will be resized.
        externalVal - The value to parse
        dimension - The expected number of values for the point
        Returns:
        An array of the values that make up the point (aka vector)
        Throws:
        InvalidShapeException - if the dimension specified does not match the number of values in the externalValue.
      • parseLatitudeLongitude

        public static final double[] parseLatitudeLongitude​(String latLonStr)
                                                     throws InvalidShapeException
        Deprecated.
        Extract (by calling parsePoint(String[], String, int) and validate the latitude and longitude contained in the String by making sure the latitude is between 90 & -90 and longitude is between -180 and 180.

        The latitude is assumed to be the first part of the string and the longitude the second part.

        Parameters:
        latLonStr - The string to parse. Latitude is the first value, longitude is the second.
        Returns:
        The lat long
        Throws:
        InvalidShapeException - if there was an error parsing