FRAMES NO FRAMES | |||||||
| |||||||
SUMMARY: IMPORT | CONSTANT | MEMBER | ACTION | DETAIL: IMPORT | CONSTANT | MEMBER | ACTION |
event GPSPosition {This event could distinguish between a GPS fix (in which case all of the members of GPSPosition are available and should be valid) and no GPS fix, and a nearest mobile phone cell or no cells being in range. Also note how it can distinguish between Wi-Fi switched on but no networks in range (non-empty optional containing a zero-length sequence) and Wi-Fi switched off (an empty optional). The deviceId and timestamp are always available in the SmartPhonePosition event.
float longitude;
float latitude;
float accuracy;
integer numSatFix;
}
event SmartPhonePosition {
string deviceId;
float timestamp;
optional<GPSPosition> gps;
optional<string> nearestCellId;
optional<sequence<string>> nearestWiFiMacAddresses;
}
optional<TYPE> varnameFor example:
// An optional that may or may not contain an integerThe default value of an optional is an empty value. There is a single argument constructor:
optional<integer> myOptInt;
optional<integer> myOptInt := optional<integer>(5);But it is also possible to assign a variable or literal of type TYPE to an optional<TYPE>. For example:
optional<integer> myOptInt := 5;See the documentation of the different types for detailed information on how to declare the literals.
Action summary | |
---|---|
boolean | static canParse(string s)
Check if the string argument can be successfully parsed as an optional. |
optional<TYPE> |
clone()
Create a deep copy of this optional. |
boolean |
empty()
Check if this optional has a value. |
TYPE |
getOr(TYPE default)
Get the value of this optional or a specified default. |
TYPE |
getOrThrow()
Get the value of this optional. |
integer |
hash()
Get an integer hash representation of the underlying object. |
optional<TYPE> | static parse(string s)
Parse a string as an optional. |
string |
toString()
Convert this optional to a string. |
Action detail |
---|
boolean static canParse(string s)Check if the string argument can be successfully parsed as an optional.
optional<TYPE> clone()Create a deep copy of this optional.
boolean empty()Check if this optional has a value.
TYPE getOr(TYPE default)Get the value of this optional or a specified default.
TYPE getOrThrow()Get the value of this optional.
integer hash()Get an integer hash representation of the underlying object.
optional<TYPE> static parse(string s)Parse a string as an optional.
string toString()Convert this optional to a string.
FRAMES NO FRAMES | |||||||
| |||||||
SUMMARY: IMPORT | CONSTANT | MEMBER | ACTION | DETAIL: IMPORT | CONSTANT | MEMBER | ACTION |