public class Observation extends java.lang.Object implements java.lang.Comparable<Observation>
The rest of the Observation data is specified as a set of Key-Value properties. Although there is no restrictions on property keys, the Smart Platform defines a set of general observation types, and these property names should be used if possible.
Modifier and Type | Field and Description |
---|---|
static int |
ID_NONE |
Constructor and Description |
---|
Observation()
Initializes timestamp based on system time.
|
Modifier and Type | Method and Description |
---|---|
int |
compareTo(Observation another) |
long |
getId() |
Position |
getPosition() |
java.util.Map<java.lang.String,java.lang.String> |
getPropertiesAsStrings() |
java.lang.String |
getPropertyAsString(java.lang.String key) |
long |
getTimestamp() |
void |
setId(long id)
The Observation class has a field for a numerical id, such as
a database key.
|
void |
setPosition(Position pos) |
void |
setPropertiesAsStrings(java.util.Map<java.lang.String,java.lang.String> props) |
void |
setPropertyAsString(java.lang.String key,
java.lang.String value)
Add a key-value pair to the event.
|
void |
setTimestamp(long timestamp) |
public static final int ID_NONE
public long getId()
public void setId(long id)
id
- unique numerical idpublic long getTimestamp()
public void setTimestamp(long timestamp)
timestamp
- time of event, in milliseconds since 1970public Position getPosition()
public void setPosition(Position pos)
pos
- last know position at time of event, or nullpublic java.util.Map<java.lang.String,java.lang.String> getPropertiesAsStrings()
public void setPropertiesAsStrings(java.util.Map<java.lang.String,java.lang.String> props)
props
- key-value map of properties, or nullpublic void setPropertyAsString(java.lang.String key, java.lang.String value)
key
- value
- public java.lang.String getPropertyAsString(java.lang.String key)
key
- property namepublic int compareTo(Observation another)
compareTo
in interface java.lang.Comparable<Observation>