java.lang.Comparable<TimeStampedValue>, java.util.Map.Entry<java.lang.Long,java.lang.Object>public final class TimeStampedValue extends java.lang.Object implements java.util.Map.Entry<java.lang.Long,java.lang.Object>, java.lang.Comparable<TimeStampedValue>
The key is the time in ms and may be used in a Map.
compares the key.compareTo(TimeStampedValue)
| Constructor | Description |
|---|---|
TimeStampedValue(long key,
java.lang.Object value) |
Creates an instance with the given timestamp key and the value to time
stamp.
|
TimeStampedValue(java.lang.Object value) |
Creates an instance for the given value that is time stamped with the
current time.
|
| Modifier and Type | Method | Description |
|---|---|---|
int |
compareTo(TimeStampedValue obj) |
Compares the given
TimeStampedValue to this by the internal
getTime(). |
boolean |
equals(java.lang.Object obj) |
|
java.lang.Long |
getKey() |
Returns the
Long that marks the time stamp (difference, measured in
milliseconds, between the current time and midnight, January 1, 1970 UTC). |
long |
getTime() |
Returns the time stamp (difference, measured in milliseconds, between the
current time and midnight, January 1, 1970 UTC).
|
java.lang.Object |
getValue() |
Returns the time stamp.
|
int |
hashCode() |
|
boolean |
isPast() |
Returns whether the internal time stamp marks a time in the past or not.
|
java.lang.Object |
setValue(java.lang.Object value) |
Assigns a different value to the timestamp.
|
public TimeStampedValue(long key,
java.lang.Object value)
key - the time stamp (difference, measured in milliseconds, between the
current time and midnight, January 1, 1970 UTC).value - the value to time stamp.public TimeStampedValue(java.lang.Object value)
value - the value to time stamp.System.currentTimeMillis()public int compareTo(TimeStampedValue obj)
TimeStampedValue to this by the internal
getTime().
compareTo in interface java.lang.Comparable<TimeStampedValue>obj - the object to compare this to.Comparable.compareTo(java.lang.Object)public boolean equals(java.lang.Object obj)
equals in interface java.util.Map.Entry<java.lang.Long,java.lang.Object>equals in class java.lang.ObjectObject.equals(java.lang.Object)public java.lang.Long getKey()
Long that marks the time stamp (difference, measured in
milliseconds, between the current time and midnight, January 1, 1970 UTC).getKey in interface java.util.Map.Entry<java.lang.Long,java.lang.Object>Long that marks the time stamp (difference, measured in
milliseconds, between the current time and midnight, January 1,
1970 UTC).Map.Entry.getKey()public long getTime()
public java.lang.Object getValue()
getValue in interface java.util.Map.Entry<java.lang.Long,java.lang.Object>Map.Entry.getValue()public int hashCode()
hashCode in interface java.util.Map.Entry<java.lang.Long,java.lang.Object>hashCode in class java.lang.ObjectObject.hashCode()public boolean isPast()
For normal a time stamp represents a value regarded at a time. But it is also thinkable to mark a value for expiration in the future. This method returns true if the internal time- representing key is smaller than the actual time.
public java.lang.Object setValue(java.lang.Object value)
setValue in interface java.util.Map.Entry<java.lang.Long,java.lang.Object>value - the new value to be marked with this timestamp.Map.Entry.setValue(java.lang.Object)Copyright © 2001 - 2010 LGPL, All Rights Footloose.