|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectlejos.realtime.HighResolutionTime
public abstract class HighResolutionTime
Constructor Summary | |
---|---|
HighResolutionTime()
|
Method Summary | |
---|---|
abstract AbsoluteTime |
absolute(Clock clock)
Convert the time of this to an absolute time, using the given instance of Clock to determine the current time when necessary. |
abstract AbsoluteTime |
absolute(Clock clock,
AbsoluteTime dest)
Convert the time of this to an absolute time, using the given instance of Clock to determine the current time when necessary. |
Object |
clone()
Return a clone of this. |
int |
compareTo(HighResolutionTime time)
Compares this HighResolutionTime with the specified HighResolutionTime time. |
int |
compareTo(Object object)
For the Comparable interface. |
boolean |
equals(HighResolutionTime time)
Returns true if the argument time has the same type and values as this. |
boolean |
equals(Object object)
Returns true if the argument object has the same type and values as this. |
Clock |
getClock()
Returns a reference to the clock associated with this. |
long |
getMilliseconds()
Returns the milliseconds component of this. |
int |
getNanoseconds()
Returns the nanoseconds component of this. |
int |
hashCode()
Returns a hash code for this object in accordance with the general contract of Object.hashCode(). |
abstract RelativeTime |
relative(Clock clock)
Convert the time of this to a relative time, using the given instance of Clock to determine the current time when necessary. |
abstract RelativeTime |
relative(Clock clock,
RelativeTime dest)
Convert the time of this to a relative time, using the given instance of Clock to determine the current time when necessary. |
void |
set(HighResolutionTime time)
Change the value represented by this to that of the given time. |
void |
set(long millis)
Sets the millisecond component of this to the given argument, and the nanosecond component of this to 0. |
void |
set(long millis,
int nanos)
Sets the millisecond and nanosecond components of this. |
static void |
waitForObject(Object target,
HighResolutionTime time)
Behaves exactly like target.wait() but with the enhancement that it waits with a precision of HighResolutionTime. |
Methods inherited from class java.lang.Object |
---|
getClass, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public HighResolutionTime()
Method Detail |
---|
public static void waitForObject(Object target, HighResolutionTime time) throws InterruptedException
target
- The object on which to wait. The current thread must have a
lock on the object.time
- The time for which to wait. If it is RelativeTime(0,0) then
wait indefinitely. If it is null then wait indefinitely.
InterruptedException
- Thrown if this schedulable object is interrupted by
RealtimeThread.interrupt() or AsynchronouslyInterruptedException.fire()
while it is waiting.
IllegalArgumentException
- Thrown if time represents a relative time less than zero.
IllegalMonitorStateException
- Thrown if target is not locked by the caller.
UnsupportedOperationException
- Thrown if the wait operation is not supported using the clock
associated with time.
See Also:
Object.wait(), Object.wait(long), Object.wait(long,int)public abstract AbsoluteTime absolute(Clock clock)
clock
- The instance of Clock used to convert the time of this into
absolute time, and the new clock association for the result.
public abstract AbsoluteTime absolute(Clock clock, AbsoluteTime dest)
clock
- The instance of Clock used to convert the time of this into
absolute time, and the new clock association for the result.dest
- If dest is not null, the result is placed there and returned.
Otherwise, a new object is allocated for the result.
public Object clone()
public int compareTo(HighResolutionTime time)
time
- Compares with the time of this.
ClassCastException
- Thrown if the time parameter is not of the same class as
this.
IllegalArgumentException
- Thrown if the time parameter is not associated with the
same clock as this, or when the time parameter is null.public int compareTo(Object object)
IllegalArgumentException
- Thrown if the object parameter is not associated with the same
clock as this, or when the object parameter is null.
ClassCastException
- Thrown if the specified object's type prevents it from being
compared to this Object.public boolean equals(HighResolutionTime time)
time
- Value compared to this.
public boolean equals(Object object)
equals
in class Object
object
- Value compared to this.
public Clock getClock()
public final long getMilliseconds()
public final int getNanoseconds()
public int hashCode()
hashCode
in class Object
public abstract RelativeTime relative(Clock clock)
clock
- The instance of Clock used to convert the time of this
into relative time, and the new clock association for the result.
public abstract RelativeTime relative(Clock clock, RelativeTime dest)
clock
- The instance of Clock used to convert the time of this into
relative time, and the new clock association for the result.dest
- If dest is not null, the result is placed there and returned.
Otherwise, a new object is allocated for the result.
public void set(HighResolutionTime time)
time
- The new value for this.
IllegalArgumentException
- Thrown if the parameter time is null.
ClassCastException
- Thrown if the type of this and the type of the parameter
time are not the same.
Since:
1.0.1 The description of the method in 1.0 was erroneous.public void set(long millis)
millis
- This value shall be the value of the millisecond component
of this at the completion of the call.public void set(long millis, int nanos) throws IllegalArgumentException
millis
- The desired value for the millisecond component of this at the
completion of the call. The actual value is the result of parameter
normalization.nanos
- The desired value for the nanosecond component of this at the
completion of the call. The actual value is the result of parameter
normalization.
IllegalArgumentException
- Thrown if there is an overflow in the millisecond component
while normalizing.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |