|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object javax.realtime.HighResolutionTime javax.realtime.RelativeTime javax.realtime.RationalTime
public class RationalTime
An object that represents a time interval milliseconds/103 + nanoseconds/109 seconds long that is divided into subintervals by some frequency. This is generally used in periodic events, threads, and feasibility analysis to specify periods where there is a basic period that must be adhered to strictly (the interval), but within that interval the periodic events are supposed to happen frequency times, as uniformly spaced as possible, but clock and scheduling jitter is moderately acceptable.
Caution: This class is explicitly unsafe in multithreaded situations when it is being changed. No synchronization is done. It is assumed that users of this class who are mutating instances will be doing their own synchronization at a higher level. All Implemented Interfaces: java.lang.Comparable
Constructor Summary | |
---|---|
RationalTime(int frequency)
Deprecated. 1.0.1 |
|
RationalTime(int frequency,
long millis,
int nanos)
Deprecated. 1.0.1 |
|
RationalTime(int frequency,
RelativeTime interval)
Deprecated. 1.0.1 |
Method Summary | |
---|---|
void |
addInterarrivalTo(AbsoluteTime destination)
Deprecated. 1.0.1 |
int |
getFrequency()
Deprecated. 1.0.1 |
RelativeTime |
getInterarrivalTime()
Deprecated. 1.0.1 |
RelativeTime |
getInterarrivalTime(RelativeTime dest)
Deprecated. 1.0.1 |
void |
set(HighResolutionTime time)
Deprecated. Change the value represented by this to that of
the given time . |
void |
set(long millis,
int nanos)
Deprecated. Sets the indicated fields to the given values. |
void |
setFrequency(int frequency)
Deprecated. 1.0.1 |
java.lang.String |
toString()
Deprecated. Create a printable string of the time given by this . |
Methods inherited from class javax.realtime.RelativeTime |
---|
absolute, absolute, add, add, add, add, relative, relative, subtract, subtract |
Methods inherited from class javax.realtime.HighResolutionTime |
---|
clone, compareTo, compareTo, equals, equals, getClock, getMilliseconds, getNanoseconds, hashCode, set, waitForObject |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public RationalTime(int frequency)
RationalTime
.
Equivalent to new RationalTime(1000, 0, frequency)
essentially a cycles-per-second value.
public RationalTime(int frequency, long millis, int nanos)
RationalTime
.
All arguments must be greater than or equal to zero.
frequency
- The frequency value.millis
- The milliseconds value.nanos
- The nanoseconds value.
java.lang.IllegalArgumentException
- If any of the argument values are less than zero.public RationalTime(int frequency, RelativeTime interval)
RationalTime
from the given RelativeTime
.
frequency
- The frequency value.interval
- The given instance of RelativeTime
.
java.lang.IllegalArgumentException
- If any of the argument values are less than zero.Method Detail |
---|
public void addInterarrivalTo(AbsoluteTime destination)
this
to an AbsoluteTime
It is almost the same dest.add(this, dest)
except
that it accounts for (i.e. divides by) the frequency.
addInterarrivalTo
in class RelativeTime
destination
- A reference to the destination instance.public int getFrequency()
frequency
.
frequency
as an integer.public RelativeTime getInterarrivalTime()
RelativeTime
.
getInterarrivalTime
in class RelativeTime
RelativeTime
with the same
interval as this
.public RelativeTime getInterarrivalTime(RelativeTime dest)
RelativeTime
.
getInterarrivalTime
in class RelativeTime
dest
- Result is stored in dest and returned, if null, a new object is returned.
public void set(long millis, int nanos)
set
in class HighResolutionTime
millis
- The new value for the millisecond field.nanos
- The new value for the nanosecond field.public void setFrequency(int frequency)
frequency
field.
frequency
- The new value for the frequency
.public java.lang.String toString()
this
.
toString
in class RelativeTime
this
.public void set(HighResolutionTime time)
HighResolutionTime
this
to that of
the given time
. If the time parameter is null
this method will throw IllegalArgumentException. If the type
of this and the type of the given time are not the same this
method will throw ClassCastException. The clock associated with
this is set to be the clock associated with the time parameter.
set
in class HighResolutionTime
time
- The new value for this
.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |