/** * Get an optional long value associated with a key, or zero if there is no * such key or if the 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. * @return An object which is the value. */ public long optLong(String key) { return optLong(key, 0); }
/** * Get an optional long value associated with a key, or zero if there is no * such key or if the 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. * @return An object which is the value. */ public long optLong(String key) { return optLong(key, 0); }
/** * Get an optional long value associated with a key, or zero if there is no * such key or if the 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. * @return An object which is the value. */ public long optLong(Enum<?> key) { return optLong(key.name()); }
/** * Get an optional long value associated with a key, or zero if there is no * such key or if the 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. * @return An object which is the value. */ public long optLong(Enum<?> key) { return optLong(key.name()); }
/** * Get an optional long value associated with a key, or the default if there * is no such key or if the 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 long optLong(Enum<?> key, long defaultValue) { return optLong(key.name(), defaultValue); }
/** * Get an optional long value associated with a key, or the default if there * is no such key or if the 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 long optLong(Enum<?> key, long defaultValue) { return optLong(key.name(), defaultValue); }
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); }
chargePortOpen = source.optBoolean("charge_port_door_open"); scheduledChargePending = source.optBoolean("scheduled_charging_pending"); scheduledStart = source.optLong("scheduled_charging_start_time"); chargerPilotCurrent = source.optInt("charger_pilot_current", -1); chargerActualCurrent = source.optInt("charger_actual_current");