|
||||||||||
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
An object that represents a time interval millis/1E3+nanos/1E9
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 aresupposed to happenfrequencytimes,asuniformly
spaced as possible,butclock and scheduling jitter is moderately
acceptable. If the value of any of the millisecond or nanosecond
fields is negative the variable is set to negative value. Although
logically this may represent time before the epoch, invalid results
may occur if an instance of AbsoluteTime representing time before
the epoch is given as a parameter to the a method.
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.
Field Summary | |
protected int |
frequency
|
Fields inherited from class javax.realtime.HighResolutionTime |
millis, nanos |
Constructor Summary | |
RationalTime(int frequency)
Construct a new Object of RationalTime Equivalent to new Rational-Time( 1000, 0, frequency)---essentially a cycles-per-second value. |
|
RationalTime(int frequency,
long millis,
int nanos)
Construct a new Object of RationalTime. |
|
RationalTime(int frequency,
RelativeTime interval)
Construct a new Object of RationalTime from the given RelativeTime. |
Method Summary | |
void |
addInterarrivalTo(AbsoluteTime destination)
Add thistime to an AbsoluteTime. |
int |
getFrequency()
Gets the frequency associated with this. |
RelativeTime |
getInterarrivalTime()
Gets the time duration between two consecutive ticks using frequency. |
void |
getInterarrivalTime(RelativeTime destination)
Gets the time duration between two consecutive ticks using frequency. |
void |
set(long millis,
int nanos)
Change the indicated interval of this to the sum of the values of the arguments. |
void |
setFrequency(int frequency)
Set the frequency of this. |
Methods inherited from class javax.realtime.RelativeTime |
absolute, absolute, add, add, add, add, decrement, increment, subtract, subtract, toString |
Methods inherited from class javax.realtime.HighResolutionTime |
compareTo, compareTo, equals, equals, getMilliseconds, getNanoseconds, hashCode, set, set, waitForObject |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
protected int frequency
Constructor Detail |
public RationalTime(int frequency)
frequency
- the frequency value of this RationalTime.public RationalTime(int frequency, long millis, int nanos) throws IllegalArgumentException
frequency
- the frequency value of this RationalTime.millis
- the milli seconds value of this RationalTime.nanos
- the nano seconds value of this RationalTime.public RationalTime(int frequency, RelativeTime interval) throws IllegalArgumentException
frequency
- the frequency value of this RationalTime.interval
- the interval that defines this RationalTime.
IllegalArgumentException
- if an error occursMethod Detail |
public void addInterarrivalTo(AbsoluteTime destination)
destination
- the AbsoluteTime that will be augmented with
the interarrival-time associated to this RationalTime.public int getFrequency()
public RelativeTime getInterarrivalTime()
public void getInterarrivalTime(RelativeTime destination)
destination
- the destination for the interarrival-timepublic void set(long millis, int nanos) throws IllegalArgumentException
set
in class HighResolutionTime
millis
- the millisecond component.nanos
- the nanosecond component.
IllegalArgumentException
- if any of the argument is negative.public void setFrequency(int frequency) throws ArithmeticException
frequency
- the frequency value.
ArithmeticException
- if the frequency is not positive.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |