/** Helper method. Gets a double by key. Returns 0 if no property exists or it is malformed */ public static double getAsDouble(String key) { String i = Parameters.getString(key); try { return Double.valueOf(i).doubleValue(); } catch (NumberFormatException e) { System.err.println("Malformed double in properties for key=" + key + ":" + i); } return 0.0; }
/** Helper method. Gets an integer by key. Returns 0 if no property exists or it is malformed */ public static int getAsInteger(String key) { String i = Parameters.getString(key); try { return Integer.parseInt(i); } catch (NumberFormatException e) { System.err.println("Malformed integer in properties for key=" + key + ":" + i); } return 0; }
/** * Helper method. Gets a boolean by key. Returns true only if the property is true in either case */ public static boolean getAsBoolean(String key) { String s = Parameters.getString(key); return str2Bool(s); }