|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectinfo.monitorenter.util.TimeStampedValue
public final class TimeStampedValue
Simple wrapper around a time in ms and a value Object.
The key is the time in ms and may be used in a Map.
compares the key.
compareTo(java.lang.Object)
| Constructor Summary | |
|---|---|
TimeStampedValue(long key,
Object value)
Creates an instance with the given timestamp key and the value to timestamp. |
|
TimeStampedValue(Object value)
Creates an instance for the given value that is timestamped with the current time. |
|
| Method Summary | |
|---|---|
int |
compareTo(Object obj)
Compares the given TimeStampedValue to this by the internal getTime(). |
boolean |
equals(Object o)
Returns true, if o! |
Object |
getKey()
Returns the Long that marks the timestamp (difference, measured in milliseconds,
between the current time and midnight, January 1, 1970 UTC). |
long |
getTime()
Returns the timestamp (difference, measured in milliseconds, between the current time and midnight, January 1, 1970 UTC). |
Object |
getValue()
Returns the timestamped instance. |
int |
hashCode()
|
boolean |
isPast()
Returns wethter the internal timestamp marks a time in the past or not. |
Object |
setValue(Object value)
Assigns a different value to the timestamp. |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public TimeStampedValue(long key,
Object value)
key - the timestamp (difference, measured in milliseconds, between the current time and
midnight, January 1, 1970 UTC).value - the value to timestamp.public TimeStampedValue(Object value)
value - the value to timestamp.System.currentTimeMillis()| Method Detail |
|---|
public Object getKey()
Long that marks the timestamp (difference, measured in milliseconds,
between the current time and midnight, January 1, 1970 UTC).
getKey in interface Map.EntryLong that marks the timestamp (difference, measured in milliseconds,
between the current time and midnight, January 1, 1970 UTC).Map.Entry.getKey()public Object getValue()
getValue in interface Map.EntryMap.Entry.getValue()public long getTime()
public boolean equals(Object o)
equals in interface Map.Entryequals in class Objecto - the TimeStampedValue to compare this instance to.
public int hashCode()
hashCode in interface Map.EntryhashCode in class ObjectObject.hashCode()public Object setValue(Object value)
setValue in interface Map.Entryvalue - the new value to be marked with this timestamp.
Map.Entry.setValue(java.lang.Object)public int compareTo(Object obj)
TimeStampedValue to this by the internal getTime().
compareTo in interface Comparableobj - the object to compare this to.Comparable.compareTo(java.lang.Object)public boolean isPast()
For normal a timestamp 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.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||