Package de.yanwittmann.util
Class Util
java.lang.Object
de.yanwittmann.util.Util
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidWill convert the passed data into a configuration-friendly format and add it to the JSON Object under the given key.static org.json.JSONObjectdeepMerge(org.json.JSONObject source, org.json.JSONObject target)static StringfinalizeBuildString(String build)static ListinitializeListIfNull(List list)static doublemapRange(double a1, double a2, double b1, double b2, double s)Written by rosettacode.orgstatic doubleroundToDecimals(double d, int c)
-
Constructor Details
-
Util
public Util()
-
-
Method Details
-
deepMerge
public static org.json.JSONObject deepMerge(org.json.JSONObject source, org.json.JSONObject target) throws org.json.JSONExceptionWritten by erel-segal-halevi from this Stack Overflow answer
Merge "source" into "target". If fields have equal name, merge them recursively.- Returns:
- the merged object (target).
- Throws:
org.json.JSONException
-
initializeListIfNull
-
addToJson
Will convert the passed data into a configuration-friendly format and add it to the JSON Object under the given key.- Parameters:
json- The JSON Object to add the data to.key- The key under which to add the data.element- The element to convert and add to the JSON Object.
-
mapRange
public static double mapRange(double a1, double a2, double b1, double b2, double s)Written by rosettacode.org- Parameters:
a1- The lower end of the original range.a2- The upper end of the original range.b1- The lower end of the destination range.b2- The upper end of the destination range.s- The number to convert from the original range to the destination range.- Returns:
- The number converted from the original range to the destination range.
-
roundToDecimals
public static double roundToDecimals(double d, int c) -
finalizeBuildString
-