|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.instantreality.InstantIO.Data
public final class Data
Helper class that combines a data value with a timestamp.
This class is used when writing values into InSlots
or when reading values from OutSlots
to transfer timestamps between different software components.
The timestamp is a long
value that specifies the
number of milliseconds since midnight January 1., 1970 UTC.
The following code snippet demonstrates how to use the Data class when pushing boolean values with the current system time into OutSlots:
OutSlot outSlot = ...; Boolean value = new Boolean(true); long timeStamp = System.currentTimeMillis(); Data data = new Data(value, timeStamp); outSlot.push(data);
The following code snippet demonstrates how to use the Data class when receiving boolean values from InSlots:
InSlot inSlot = ...; Data data = inSlot.popData(); Boolean value = (Boolean) data.getValue(); long timeStamp = data.getTimeStamp();
OutSlot
,
InSlot
Constructor Summary | |
---|---|
Data(java.lang.Object value)
Creates a new Data object that contains a given value and whose timestamp is set to the current system time. |
|
Data(java.lang.Object value,
long timeStamp)
Creates a new Data object that contains a given value and whose timestamp is set to a given timestamp. |
Method Summary | |
---|---|
long |
getTimeStamp()
Returns the timestamp. |
java.lang.Object |
getValue()
Returns the data value. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Data(java.lang.Object value)
The following example demonstrates how to create a new Data object with a boolean value and the current system time, and push it into an OutSlot:
OutSlot outSlot = ...; Data data = new Data(new Boolean(true)); outSlot.push(data);
value
- The value that is put into the Data object.public Data(java.lang.Object value, long timeStamp)
The following example demonstrates how to create a new Data object with a boolean value and the current system time, and push it into an OutSlot:
OutSlot outSlot = ...; Data data = new Data(new Boolean(true), System.currentTimeMillis()); outSlot.push(data);
value
- The value that is put into the Data object.timeStamp
- The timestamp of the data value. This is
a long
value that specifies the number of
milliseconds since midnight January 1., 1970 UTC.Method Detail |
---|
public java.lang.Object getValue()
The following example demonstrates how to receive a boolean value from an OutSlot and print the value and its timestamp to the console:
InSlot inSlot = ...; Data data = inSlot.popData(); Boolean value = (Boolean) data.getValue(); long timeStamp = data.getTimeStamp(); System.out.println("Value = " + value + ", Timestamp = " + timeStamp);
public long getTimeStamp()
InSlot inSlot = ...; Data data = inSlot.popData(); Boolean value = (Boolean) data.getValue(); long timeStamp = data.getTimeStamp(); System.out.println("Value = " + value + ", Timestamp = " + timeStamp);
long
value that
specifies the number of milliseconds since midnight
January 1., 1970 UTC.
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |