|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.cau.cs.kieler.sim.kiem.JSONSignalValues
public final class JSONSignalValues
The Class JSONSignalValues. This is an implementation of a CONVENTION for representing
signal values in JSON format. This convention is used to explicitly denote the presents/absents
of pure and valued signals.
Signals in JSON format should contain not just a value but a JSONSignalValue. That is they
contain a JSONObject as their value, where at least one parameter is called present and
this parameter is of type boolean, indicating the presents or absents of a signal.
Examples:
Valued signal a, present, with an integer value of 10:
a:{present:true, value:10}
Valued signal a, absent, with a string value of "hello signal":
a:{present:false, value:"hello signal"}
Pure signal b, present
b:{present:true}
Pure signal b, absent
b:{present:absent}
Field Summary | |
---|---|
static String |
PRESENT_KEY
The present key of this *CONVENTION*. |
static String |
VALUE_KEY
The value key of this *CONVENTION*. |
Method Summary | |
---|---|
static Object |
getSignalValue(Object signalValue)
Gets the value of a SignalValue. |
static boolean |
isPresent(Object signalValue)
Checks whether the signal of this SignalValue is present. |
static boolean |
isSignalValue(Object signalValue)
Checks if this Object is a SignalValue. |
static JSONObject |
newValue(boolean present)
Create a new SignalValue for a pure signal, containing a presentKey only. |
static JSONObject |
newValue(Object value,
boolean present)
Create a new SignalValue for a valued signal, containing a presentKey and a valueKey. |
static void |
setPresent(JSONObject signalValue,
boolean isPresent)
Sets the presents of a signaled value. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String PRESENT_KEY
public static final String VALUE_KEY
Method Detail |
---|
public static void setPresent(JSONObject signalValue, boolean isPresent) throws JSONException
signalValue
- the JSONObject representing the signal valueisPresent
- a boolean indicating whether the signal is present
JSONException
- a JSONExceptionpublic static boolean isSignalValue(Object signalValue) throws JSONException
signalValue
- the Object to be checked
JSONException
- a JSONExceptionpublic static Object getSignalValue(Object signalValue) throws JSONException
signalValue
- the SignalValue (or Object if that is unclear)
JSONException
- a JSONExceptionpublic static boolean isPresent(Object signalValue) throws JSONException
signalValue
- the SignalValue
JSONException
- a JSONExceptionpublic static JSONObject newValue(Object value, boolean present) throws JSONException
value
- the value of the signalpresent
- true if the signal is present
JSONException
- a JSONExceptionpublic static JSONObject newValue(boolean present) throws JSONException
present
- true if the signal is present
JSONException
- a JSONException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |