|
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjavax.realtime.HighResolutionTime
javax.realtime.RelativeTime
public class RelativeTime
Jamaica Realtime Specification for Java class RelativeTime.
An instance of this class represents an interval of time measured by a Clock. The interval is given as a tupel of milliseconds and nanoseconds.
The set of intervals that can be represented by this class ranges from -((2^63)ms-999999ns to ((2^63)-1)ms+999999ns, i.e. from -9223372036854775808999999ns to 9223372036854775807999999ns.
| Constructor Summary | |
|---|---|
RelativeTime()
Constructor to create the empty interval bound to the default realtime clock. |
|
RelativeTime(Clock clock)
Constructor to create the empty interval bound to the provided clock. |
|
RelativeTime(long ms,
int ns)
Constructor to create an interval using the provided interval that is bound to the default realtime clock. |
|
RelativeTime(long ms,
int ns,
Clock clock)
Constructor to create an interval using the provided interval that is bound to the default realtime clock. |
|
RelativeTime(RelativeTime time)
Constructor to create a new RelativeTime object that represents the same interval as the given RelativeTime and that has the same clock association. |
|
RelativeTime(RelativeTime time,
Clock clock)
Constructor to create a new RelativeTime object that represents the same interval as the given RelativeTime and that has the same clock association or the clock association provided as a non-null clock parameter. |
|
| Method Summary | |
|---|---|
AbsoluteTime |
absolute(Clock clock)
absolute creates a new instance of absolute time for the point in time given by the current time of the given clock. |
AbsoluteTime |
absolute(Clock clock,
AbsoluteTime destination)
absolute converts this relative time into an instance of absolute time for the point in time given by the current time of the given clock. |
RelativeTime |
add(long millis,
int nanos)
add adds time given in milliseconds and nanoseconds to this relative time. |
RelativeTime |
add(long millis,
int nanos,
RelativeTime dest)
add adds time given in milliseconds and nanoseconds to this relative time. |
RelativeTime |
add(RelativeTime time)
add adds interval given as an instance of RelativeTime to this relative time. |
RelativeTime |
add(RelativeTime time,
RelativeTime dest)
add adds interval given as an instance of RelativeTime to this relative time. |
void |
addInterarrivalTo(AbsoluteTime destination)
Deprecated. RTSJ V1.0.1 this method is only required to support the deprecated RationalTime. |
RelativeTime |
getInterarrivalTime()
Deprecated. RTSJ V1.0.1 this method is only required to support the deprecated RationalTime. |
RelativeTime |
getInterarrivalTime(RelativeTime dest)
Deprecated. RTSJ V1.0.1 this method is only required to support the deprecated RationalTime. |
RelativeTime |
relative(Clock clock)
relative returns a new instance of this interval with the given clock association. |
RelativeTime |
relative(Clock clock,
RelativeTime destination)
relative returns a copy of this interval with the given clock association. |
RelativeTime |
subtract(RelativeTime time)
substract substracts interval given as an instance of RelativeTime from this relative time. |
RelativeTime |
subtract(RelativeTime time,
RelativeTime dest)
substract substracts interval given as an instance of RelativeTime from this relative time. |
String |
toString()
toString returns this interval as a string of the form "( |
| Methods inherited from class javax.realtime.HighResolutionTime |
|---|
compareTo, compareTo, equals, equals, getClock, getMilliseconds, getNanoseconds, hashCode, set, set, set, waitForObject |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public RelativeTime()
Constructor to create the empty interval bound to the default realtime clock.
This constructor is equivalten to RelativeTime(0,0).
public RelativeTime(long ms,
int ns)
Constructor to create an interval using the provided interval that is bound to the default realtime clock.
This constructor is equivalten to RelativeTime(0,0).
ms - the milliseconds part of the intervalns - the nanoseconds part of the interval.
IllegalArgumentException - if normalization of millis and
nanos caused an overflow.public RelativeTime(RelativeTime time)
time - the original RelativeTime.
+ @throws IllegalArgumentException if time is null.public RelativeTime(Clock clock)
Constructor to create the empty interval bound to the provided clock.
This constructor is equivalten to RelativeTime(0,0).
clock - the clock to be associated with this time,
null to use Clock.getRealtimeClock().
public RelativeTime(long ms,
int ns,
Clock clock)
Constructor to create an interval using the provided interval that is bound to the default realtime clock.
This constructor is equivalten to RelativeTime(0,0).
ms - the milliseconds part of the intervalns - the nanoseconds part of the interval.clock - the clock to be associated with this time,
null to use Clock.getRealtimeClock().
IllegalArgumentException - if normalization of millis and
nanos caused an overflow.
public RelativeTime(RelativeTime time,
Clock clock)
time - the original RelativeTime.clock - the clock association. May be null to use
time.getClock().
+ @throws IllegalArgumentException if time is null.| Method Detail |
|---|
public AbsoluteTime absolute(Clock clock,
AbsoluteTime destination)
absolute in class HighResolutionTimeclock - The clock, null to use Clock.getRealtimeClock().destination - the destination absolute time object.
ArithmeticException - if the resulting absolute time could
not be prepresented in an instance of AbsoluteTime.public AbsoluteTime absolute(Clock clock)
absolute in class HighResolutionTimeclock - The clock, null to use Clock.getRealtimeClock().
ArithmeticException - if the resulting absolute time could
not be prepresented in an instance of AbsoluteTime.public RelativeTime relative(Clock clock)
relative in class HighResolutionTimeclock - The clock, null to use Clock.getRealtimeClock().
public RelativeTime relative(Clock clock,
RelativeTime destination)
relative in class HighResolutionTimeclock - The clock, null to use Clock.getRealtimeClock().destination - the destination relative time object.
public RelativeTime add(long millis,
int nanos)
millis - the milliseconds part of the interval to be added.nanos - the nanoseconds part of the interval to be added.
ArithmeticException - if the addition or normalization
results in an overflow.
public RelativeTime add(long millis,
int nanos,
RelativeTime dest)
millis - the milliseconds part of the interval to be added.nanos - the nanoseconds part of the interval to be added.dest - The preallocated RelativeTime object to hold the
result. May be null to indicate that a new object should be
allocated.
ArithmeticException - if the addition or normalization
results in an overflow.public RelativeTime add(RelativeTime time)
time - the time to be added.
ArithmeticException - if the addition or normalization
results in an overflow.
IllegalArgumentException - if time is null or
time.getClock() != getClock().
public RelativeTime add(RelativeTime time,
RelativeTime dest)
time - the time to be added.dest - The preallocated RelativeTime object to hold the
result. May be null to indicate that a new object should be
allocated.
ArithmeticException - if the addition or normalization
results in an overflow.
IllegalArgumentException - if time is null or
time.getClock() != getClock().
public void addInterarrivalTo(AbsoluteTime destination)
throws NullPointerException
destination -
NullPointerExceptionpublic RelativeTime getInterarrivalTime()
public RelativeTime getInterarrivalTime(RelativeTime dest)
dest - The preallocated RelativeTime object to hold the
result. May be null to indicate that a new object should be
allocated.
public RelativeTime subtract(RelativeTime time)
time - the time to be added.
ArithmeticException - if the subsctraction or normalization
results in an overflow.
public RelativeTime subtract(RelativeTime time,
RelativeTime dest)
time - the time to be added.dest - The preallocated RelativeTime object to hold the
result. May be null to indicate that a new object should be
allocated.
ArithmeticException - if the subsctraction or normalization
results in an overflow.
IllegalArgumentException - if time is null or
time.getClock() != getClock().public String toString()
toString in class Object
|
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||