/** * 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 optDouble(key, 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 optDouble(key, 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(Enum<?> key) { return optDouble(key.name()); }
/** * 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(Enum<?> key) { return optDouble(key.name()); }
/** * Get an optional double associated with a key, or the defaultValue 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 key string. * @param defaultValue * The default. * @return An object which is the value. */ public double optDouble(Enum<?> key, double defaultValue) { return optDouble(key.name(), defaultValue); }
/** * Get an optional double associated with a key, or the defaultValue 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 key string. * @param defaultValue * The default. * @return An object which is the value. */ public double optDouble(Enum<?> key, double defaultValue) { return optDouble(key.name(), defaultValue); }
public HVACState(JSONObject source) { super(source); insideTemp = source.optDouble("inside_temp"); outsideTemp = source.optDouble("outside_temp"); driverTemp = source.optDouble("driver_temp_setting"); passengerTemp = source.optDouble("passenger_temp_setting"); autoConditioning = source.optBoolean("is_auto_conditioning_on"); isFrontDefrosterOn = source.optInt("is_front_defroster_on"); isRearDefrosterOn = source.optBoolean("is_rear_defroster_on"); fanStatus = source.optInt("fan_status"); }
public StreamState(JSONObject source) { super(source); vehicleTimestamp = source.optLong(Streamer.Keys.timestamp); speed = source.optDouble(Streamer.Keys.speed); if (Double.isNaN(speed)) speed = 0.0; odometer = source.optDouble(Streamer.Keys.odometer); soc = source.optInt(Streamer.Keys.soc); elevation = source.optInt(Streamer.Keys.elevation); estHeading = source.optInt(Streamer.Keys.est_heading); heading = source.optInt(Streamer.Keys.heading); estLat = source.optDouble(Streamer.Keys.est_lat); estLng = source.optDouble(Streamer.Keys.est_lng); power = source.optInt(Streamer.Keys.power); shiftState = source.optString(Streamer.Keys.shift_state); range = source.optInt(Streamer.Keys.range); estRange = source.optInt(Streamer.Keys.est_range); }
chargeToMaxRange = source.optBoolean("charge_to_max_range"); maxRangeCharges = source.optInt("max_range_charge_counter"); range = source.optDouble("battery_range"); estimatedRange = source.optDouble("est_battery_range"); idealRange = source.optDouble("ideal_battery_range"); batteryPercent = source.optInt("battery_level"); batteryCurrent = source.optDouble("battery_current"); chargerVoltage = source.optInt("charger_voltage"); timeToFullCharge = source.optDouble("time_to_full_charge"); chargeRate = source.optDouble("charge_rate"); chargePortOpen = source.optBoolean("charge_port_door_open"); scheduledChargePending = source.optBoolean("scheduled_charging_pending"); fastChargerType = source.optString("fast_charger_type"); usableBatteryLevel = source.optInt("usable_battery_level"); energyAdded = source.optDouble("charge_energy_added"); ratedMilesAdded = source.optDouble("charge_miles_added_rated"); idealMilesAdded = source.optDouble("charge_miles_added_ideal"); chargeEnableRequest = source.optBoolean("charge_enable_request");