javax.realtime
Class RationalTime

java.lang.Object
  extended by javax.realtime.HighResolutionTime
      extended by javax.realtime.RelativeTime
          extended by javax.realtime.RationalTime
All Implemented Interfaces:
java.lang.Cloneable, java.lang.Comparable

Deprecated. As of RTSJ 1.0.1

public class RationalTime
extends RelativeTime

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

Mackinac comments:
Since the class is deprecated, all the methods throw UnsupportedOperationException().

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

RationalTime

public RationalTime(int frequency)
Deprecated. 1.0.1

Construct an instance of RationalTime. Equivalent to new RationalTime(1000, 0, frequency)—essentially a cycles-per-second value.


RationalTime

public RationalTime(int frequency,
                    long millis,
                    int nanos)
Deprecated. 1.0.1

Construct an instance of RationalTime. All arguments must be greater than or equal to zero.

Parameters:
frequency - The frequency value.
millis - The milliseconds value.
nanos - The nanoseconds value.
Throws:
java.lang.IllegalArgumentException - If any of the argument values are less than zero.

RationalTime

public RationalTime(int frequency,
                    RelativeTime interval)
Deprecated. 1.0.1

Construct an instance of RationalTime from the given RelativeTime.

Parameters:
frequency - The frequency value.
interval - The given instance of RelativeTime.
Throws:
java.lang.IllegalArgumentException - If any of the argument values are less than zero.
Method Detail

addInterarrivalTo

public void addInterarrivalTo(AbsoluteTime destination)
Deprecated. 1.0.1

Add the time of this to an AbsoluteTime It is almost the same dest.add(this, dest) except that it accounts for (i.e. divides by) the frequency.

Overrides:
addInterarrivalTo in class RelativeTime
Parameters:
destination - A reference to the destination instance.

getFrequency

public int getFrequency()
Deprecated. 1.0.1

Gets the value of frequency.

Returns:
The value of frequency as an integer.

getInterarrivalTime

public RelativeTime getInterarrivalTime()
Deprecated. 1.0.1

Gets the interarrival time. This time is (milliseconds/103 + nanoseconds/109)/frequency rounded down to the nearest expressible value of the fields and their types of RelativeTime.

Overrides:
getInterarrivalTime in class RelativeTime
Returns:
A reference to a new instance of RelativeTime with the same interval as this.

getInterarrivalTime

public RelativeTime getInterarrivalTime(RelativeTime dest)
Deprecated. 1.0.1

Gets the interarrival time. This time is (milliseconds/103 + nanoseconds/109)/frequency rounded down to the nearest expressible value of the fields and their types of RelativeTime.

Overrides:
getInterarrivalTime in class RelativeTime
Parameters:
dest - Result is stored in dest and returned, if null, a new object is returned.
Returns:
A reference to an object holding the result.

set

public void set(long millis,
                int nanos)
Deprecated. 
Sets the indicated fields to the given values.

Overrides:
set in class HighResolutionTime
Parameters:
millis - The new value for the millisecond field.
nanos - The new value for the nanosecond field.

setFrequency

public void setFrequency(int frequency)
Deprecated. 1.0.1

Sets the value of the frequency field.

Parameters:
frequency - The new value for the frequency.

toString

public java.lang.String toString()
Deprecated. 
Create a printable string of the time given by this.

Overrides:
toString in class RelativeTime
Returns:
String object converted from the time given by this.

set

public void set(HighResolutionTime time)
Deprecated. 
Description copied from class: HighResolutionTime
Change the value represented by 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.

Overrides:
set in class HighResolutionTime
Parameters:
time - The new value for this.