/** * Get extra double value. * @param key The key of the stored value. * @param defaultValue The value to return if the key does not exist or the value cannot be * coerced into the necessary type. * @return The stored value or the provided default if it doesn't exist in specified form. */ public double optExtraDouble(String key, double defaultValue) { return mExtraData.optDouble(key, defaultValue); }
/** * Get extra double value. * @param key The key of the stored value. * @param defaultValue The value to return if the key does not exist or the value cannot be * coerced into the necessary type. * @return The stored value or the provided default if it doesn't exist in specified form. */ public double optExtraDouble(String key, double defaultValue) { return mExtraData.optDouble(key, defaultValue); }
/** * Get extra double value. * @param key The key of the stored value. * @return The stored value or 0 if it doesn't exist in specified form. */ public double optExtraDouble(String key) { return mExtraData.optDouble(key); }
/** * Get extra double value. * @param key The key of the stored value. * @return The stored value or 0 if it doesn't exist in specified form. */ public double optExtraDouble(String key) { return mExtraData.optDouble(key); }
/** * Get an optional double associated with a key, or NaN if there is no such * key or if its value is not a number. If the value is a string, an attempt * will be made to evaluate it as a number. * * @param key * A string which is the key. * @return An object which is the value. */ public double optDouble(String key) { return this.optDouble(key, Double.NaN); }
/** * Returns the value mapped by {@code name} if it exists and is a double or * can be coerced to a double. Returns {@code NaN} otherwise. */ public double optDouble(String name) { return optDouble(name, Double.NaN); }
/** * Returns the value mapped by {@code name} if it exists and is a double or can be coerced to a * double, or {@code NaN} otherwise. * * @param name The name of the field we want. * @return The selected value if it exists. */ public double optDouble(String name) { return optDouble(name, Double.NaN); }
/** * Get an optional double associated with a key, or NaN if there is no such * key or if its value is not a number. If the value is a string, an attempt * will be made to evaluate it as a number. * * @param key * A string which is the key. * @return An object which is the value. */ public double optDouble(String key) { return this.optDouble(key, Double.NaN); }
public double getDouble(String key) { return jsonObject.optDouble(key); }
/** Integer interval after interval factor and prev+1 constraints applied */ private int _constrainedIvl(int ivl, JSONObject conf, double prev) { double newIvl = ivl; newIvl = ivl * conf.optDouble("ivlFct",1.0); return (int) Math.max(newIvl, prev + 1); }
public LatLng getPosition() { JSONObject location = jsonData.optJSONObject(LOCATION); if (location != null) { if (location.has("latitude") && location.has("longitude")) { double latitude = location.optDouble("latitude"); double longitude = location.optDouble("longitude"); return new LatLng(latitude, longitude); } } return null; }
cell.setIndicatorMargin(Style.parseSize(data.optString(ATTR_INDICATOR_MARGIN), 0)); cell.setIndicatorHeight(Style.parseSize(data.optString(ATTR_INDICATOR_HEIGHT), 0)); cell.setPageWidth(data.optDouble(ATTR_PAGE_WIDTH)); cell.sethGap(Style.parseSize(data.optString(ATTR_HGAP), 0)); cell.itemRatio = data.optDouble(BannerCard.ATTR_ITEM_RATIO, Double.NaN); cell.itemMargin[0] = Style.parseSize(data.optString(ATTR_ITEM_MARGIN_LEFT), 0); cell.itemMargin[1] = Style.parseSize(data.optString(ATTR_ITEM_MARGIN_RIGHT), 0);
r.put("ivlFct", r.optDouble("ivlFct", 1)); if (r.has("ivlfct")) { r.remove("ivlfct");
/** * Get an optional double associated with a key, or NaN if there is no such * key or if its value is not a number. If the value is a string, an attempt * will be made to evaluate it as a number. * * @param key * A string which is the key. * @return An object which is the value. */ public double optDouble(String key) { return this.optDouble(key, Double.NaN); }
public static ColoredRectangleActor fromJSON(JSONObject json) throws JSONException { String type = json.getString(Actor.TYPE_KEY); Vector2D position = Vector2D.get((float) json.optDouble(X_KEY, 0), (float) json.optDouble(Y_KEY, 0)); Vector2D dimens = Vector2D.get( (float) json.optDouble(DIMENS_X_KEY, 0), (float) json.optDouble(DIMENS_Y_KEY, 0)); return new ColoredRectangleActor(position, dimens, type); }
private void init(JSONObject jElement) { if (jElement.has("type") && "ELEMENT".equals(jElement.getString("type"))) { x = jElement.optInt("x", 0); y = jElement.optInt("y", 0); h = jElement.optInt("h", -1); w = jElement.optInt("w", -1); score = jElement.optDouble("score", -1); if (!jElement.isNull("name")) { name = jElement.getString("name"); } if (!jElement.isNull("lastMatch")) { lastMatch = new Element(); JSONObject jLastMatch = jElement.getJSONObject("lastMatch"); lastMatch.x = jLastMatch.optInt("x", 0); lastMatch.y = jLastMatch.optInt("y", 0); lastMatch.h = jLastMatch.optInt("h", -1); lastMatch.w = jLastMatch.optInt("w", -1); lastMatch.score = jLastMatch.optDouble("score", 0); } } else { log.error("new (JSONObject jElement): not super-type ELEMENT: %s", jElement); } }