类 FormatUtils

java.lang.Object
ai.nextbillion.kits.directions.utils.FormatUtils

public class FormatUtils extends Object
Methods to convert models to Strings.
  • 构造器详细资料

    • FormatUtils

      public FormatUtils()
  • 方法详细资料

    • join

      @Nullable public static String join(@NonNull CharSequence delimiter, @Nullable List<?> tokens)
      Returns a string containing the tokens joined by delimiters. Doesn't remove trailing nulls.
      参数:
      delimiter - the delimiter on which to split.
      tokens - A list of objects to be joined. Strings will be formed from the objects by calling object.toString().
      返回:
      String
    • join

      @Nullable public static String join(@NonNull CharSequence delimiter, @Nullable List<?> tokens, boolean removeTrailingNulls)
      Returns a string containing the tokens joined by delimiters.
      参数:
      delimiter - the delimiter on which to split.
      tokens - A list of objects to be joined. Strings will be formed from the objects by calling object.toString().
      removeTrailingNulls - true if trailing nulls should be removed.
      返回:
      String
    • formatCoordinate

      @NonNull public static String formatCoordinate(double coordinate)
      Useful to remove any trailing zeros and prevent a coordinate being over 7 significant figures.
      参数:
      coordinate - a double value representing a coordinate.
      返回:
      a formatted string.
    • formatRadiuses

      @Nullable public static String formatRadiuses(@Nullable List<Double> radiuses)
      Used in various APIs to format the user provided radiuses to a String matching the APIs format.
      参数:
      radiuses - a list of doubles represents the radius values
      返回:
      a String ready for being passed into the Retrofit call
    • formatBearings

      @Nullable public static String formatBearings(@Nullable List<List<Double>> bearings)
      Formats the bearing variables from the raw values to a string which can than be used for the request URL.
      参数:
      bearings - a List of list of doubles representing bearing values
      返回:
      a string with the bearing values
    • formatDistributions

      @Nullable public static String formatDistributions(@Nullable List<Integer[]> distributions)
      Converts the list of integer arrays to a string ready for API consumption.
      参数:
      distributions - the list of integer arrays representing the distribution
      返回:
      a string with the distribution values
    • formatApproaches

      @Nullable public static String formatApproaches(@Nullable List<String> approaches)
      Converts String list with approaches values to a string ready for API consumption. An approach could be unrestricted, curb or null.
      参数:
      approaches - a list representing approaches to each coordinate.
      返回:
      a formatted string.
    • formatWaypointNames

      @Nullable public static String formatWaypointNames(@Nullable List<String> waypointNames)
      Converts String list with waypoint_names values to a string ready for API consumption.
      参数:
      waypointNames - a string representing approaches to each coordinate.
      返回:
      a formatted string.
    • formatCoordinates

      @Nullable public static String formatCoordinates(@NonNull List<ai.nextbillion.kits.geojson.Point> coordinates)
      Converts a list of Points to String.
      参数:
      coordinates - a list of coordinates.
      返回:
      a formatted string.
    • formatPointsList

      @Nullable public static String formatPointsList(@Nullable List<ai.nextbillion.kits.geojson.Point> points)
      Converts array of Points with waypoint_targets values to a string ready for API consumption.
      参数:
      points - a list representing approaches to each coordinate.
      返回:
      a formatted string.