类 FormatUtils
java.lang.Object
ai.nextbillion.kits.directions.utils.FormatUtils
Methods to convert models to Strings.
-
构造器概要
构造器 -
方法概要
修饰符和类型方法说明static StringformatApproaches(List<String> approaches) Converts String list with approaches values to a string ready for API consumption.static StringformatBearings(List<List<Double>> bearings) Formats the bearing variables from the raw values to a string which can than be used for the request URL.static StringformatCoordinate(double coordinate) Useful to remove any trailing zeros and prevent a coordinate being over 7 significant figures.static StringformatCoordinates(List<ai.nextbillion.kits.geojson.Point> coordinates) Converts a list of Points to String.static StringformatDistributions(List<Integer[]> distributions) Converts the list of integer arrays to a string ready for API consumption.static StringformatPointsList(List<ai.nextbillion.kits.geojson.Point> points) Converts array of Points with waypoint_targets values to a string ready for API consumption.static StringformatRadiuses(List<Double> radiuses) Used in various APIs to format the user provided radiuses to a String matching the APIs format.static StringformatWaypointNames(List<String> waypointNames) Converts String list with waypoint_names values to a string ready for API consumption.static Stringjoin(CharSequence delimiter, List<?> tokens) Returns a string containing the tokens joined by delimiters.static Stringjoin(CharSequence delimiter, List<?> tokens, boolean removeTrailingNulls) Returns a string containing the tokens joined by delimiters.
-
构造器详细资料
-
FormatUtils
public FormatUtils()
-
-
方法详细资料
-
join
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
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
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
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
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
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
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.
-