Package com.graphhopper.util
Class Helper
java.lang.Object
com.graphhopper.util.Helper
- Author:
- Peter Karich
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic String
static void
createDoubleList
(double[] values) static DateFormat
This creates a date formatter for yyyy-MM-dd'T'HH:mm:ss'Z' which is has to be identical to buildDate used in pom.xmlstatic DateFormat
createFormatter
(String str) Creates a SimpleDateFormat with ENGLISH locale.static PointList
createPointList
(double... list) static PointList
createPointList3D
(double... list) static int
degreeToInt
(double deg) Converts into an integer to be compatible with the still limited DataAccess class (accepts only integer values).static int
eleToUInt
(double ele) Converts elevation value (in meters) into integer for storage.static String
static Locale
static String
static int
getSizeOfLongArray
(int length, int factor) static int
getSizeOfObjectArray
(int length, int factor) static int
getSizeOfObjectRef
(int factor) static long
static long
static int
idealByteArraySize
(int need) static int
idealIntArraySize
(int need) static double
intToDegree
(int storedInt) Converts back the integer value.static boolean
static boolean
Determines if the specified ByteBuffer is one which maps to a file!static String
isToString
(InputStream inputStream) static double
keepIn
(double value, double min, double max) This methods returns the value or min if too small or max if too big.static String
nf
(long no) parses a string like [a,b,c]static String
pruneFileEnd
(String file) static String
static String
static boolean
static double
round
(double value, int decimalPlaces) Round the value to the specified number of decimal places, i.e.static double
round2
(double value) static double
round4
(double value) static double
round6
(double value) static void
saveProperties
(Map<String, String> map, Writer tmpWriter) static int
staticHashCode
(String str) Produces a static hashcode for a string that is platform independent and still compatible to the default of openjdk.static String
toLowerCase
(String string) static Object
This method probes the specified string for a boolean, int, long, float and double.static String
toUpperCase
(String string) static double
uIntToEle
(int integEle) Converts the integer value retrieved from storage into elevation (in meters).static String
-
Field Details
-
UTF_CS
-
UTC
-
MB
public static final long MB- See Also:
-
-
Method Details
-
getLocale
-
toLowerCase
-
toUpperCase
-
saveProperties
- Throws:
IOException
-
readJSONFileWithoutComments
- Throws:
IOException
-
readJSONFileWithoutComments
- Throws:
IOException
-
readFile
- Throws:
IOException
-
readFile
- Throws:
IOException
-
isToString
- Throws:
IOException
-
idealIntArraySize
public static int idealIntArraySize(int need) -
idealByteArraySize
public static int idealByteArraySize(int need) -
removeDir
-
getTotalMB
public static long getTotalMB() -
getUsedMB
public static long getUsedMB() -
getMemInfo
-
getSizeOfObjectRef
public static int getSizeOfObjectRef(int factor) -
getSizeOfLongArray
public static int getSizeOfLongArray(int length, int factor) -
getSizeOfObjectArray
public static int getSizeOfObjectArray(int length, int factor) -
close
-
isEmpty
-
isFileMapped
Determines if the specified ByteBuffer is one which maps to a file! -
pruneFileEnd
-
createDoubleList
-
createPointList
-
createPointList3D
-
degreeToInt
public static int degreeToInt(double deg) Converts into an integer to be compatible with the still limited DataAccess class (accepts only integer values). But this conversion also reduces memory consumption where the precision loss is acceptable. As +- 180° and +-90° are assumed as maximum values.- Returns:
- the integer of the specified degree
-
intToDegree
public static double intToDegree(int storedInt) Converts back the integer value.- Returns:
- the degree value of the specified integer
-
eleToUInt
public static int eleToUInt(double ele) Converts elevation value (in meters) into integer for storage. -
uIntToEle
public static double uIntToEle(int integEle) Converts the integer value retrieved from storage into elevation (in meters). Do not expect more precision than meters although it currently is! -
nf
-
firstBig
-
keepIn
public static double keepIn(double value, double min, double max) This methods returns the value or min if too small or max if too big. -
round
public static double round(double value, int decimalPlaces) Round the value to the specified number of decimal places, i.e. decimalPlaces=2 means we round to two decimal places. Using negative values like decimalPlaces=-2 means we round to two places before the decimal point. -
round6
public static double round6(double value) -
round4
public static double round4(double value) -
round2
public static double round2(double value) -
createFormatter
This creates a date formatter for yyyy-MM-dd'T'HH:mm:ss'Z' which is has to be identical to buildDate used in pom.xml -
createFormatter
Creates a SimpleDateFormat with ENGLISH locale. -
toObject
This method probes the specified string for a boolean, int, long, float and double. If all this fails it returns the unchanged string. -
camelCaseToUnderScore
-
underScoreToCamelCase
-
parseList
parses a string like [a,b,c] -
staticHashCode
Produces a static hashcode for a string that is platform independent and still compatible to the default of openjdk. Do not use for performance critical applications.- See Also:
-