javax.realtime
Class RationalTime

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

Deprecated. This class is deprecated in version 1.0.1(b) of the RTSJ.

public class RationalTime
extends RelativeTime

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.

Author:
Angelo Corsaro, Morgan Deters

Constructor Summary
RationalTime(int frequency)
          Deprecated. 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)
          Deprecated. Construct a new Object of RationalTime.
RationalTime(int frequency, RelativeTime interval)
          Deprecated. Construct a new Object of RationalTime from the given RelativeTime.
 
Method Summary
 AbsoluteTime absolute(Clock clock, AbsoluteTime destination)
          Deprecated. The RTSJ isn't clear what we should do here; a "conversion" from RationalTime to AbsoluteTime doesn't really make sense.
 void addInterarrivalTo(AbsoluteTime destination)
          Deprecated. Add thistime to an AbsoluteTime.
 int getFrequency()
          Deprecated. Gets the frequency associated with this.
 RelativeTime getInterarrivalTime()
          Deprecated. Gets the time duration between two consecutive ticks using frequency.
 RelativeTime getInterarrivalTime(RelativeTime destination)
          Deprecated. Gets the time duration between two consecutive ticks using frequency.
 void set(long millis, int nanos)
          Deprecated. Change the indicated interval of this to the sum of the values of the arguments.
 void setFrequency(int frequency)
          Deprecated. Set the frequency of this.
 
Methods inherited from class javax.realtime.RelativeTime
absolute, add, add, add, add, decrement, increment, relative, relative, subtract, subtract, toString
 
Methods inherited from class javax.realtime.HighResolutionTime
clone, compareTo, compareTo, equals, equals, getClock, getMilliseconds, getNanoseconds, hashCode, set, set, waitForObject
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RationalTime

public RationalTime(int frequency)
Deprecated. 
Construct a new Object of RationalTime Equivalent to new Rational-Time( 1000, 0, frequency)---essentially a cycles-per-second value.

Parameters:
frequency - the frequency value of this RationalTime.

RationalTime

public RationalTime(int frequency,
                    long millis,
                    int nanos)
Deprecated. 
Construct a new Object of RationalTime. All arguments must be >= 0.

Parameters:
frequency - the frequency value of this RationalTime.
millis - the milli seconds value of this RationalTime.
nanos - the nano seconds value of this RationalTime.

RationalTime

public RationalTime(int frequency,
                    RelativeTime interval)
Deprecated. 
Construct a new Object of RationalTime from the given RelativeTime.

Parameters:
frequency - the frequency value of this RationalTime.
interval - the interval that defines this RationalTime.
Throws:
IllegalArgumentException - if an error occurs
Method Detail

addInterarrivalTo

public void addInterarrivalTo(AbsoluteTime destination)
Deprecated. 
Add thistime to an AbsoluteTime. It is almost the same dest.add(this, dest) except that it accounts for(ie. divides by) the frequency.

Overrides:
addInterarrivalTo in class RelativeTime
Parameters:
destination - the AbsoluteTime that will be augmented with the interarrival-time associated to this RationalTime.

getFrequency

public int getFrequency()
Deprecated. 
Gets the frequency associated with this.

Returns:
Return the frequency of this.

getInterarrivalTime

public RelativeTime getInterarrivalTime()
Deprecated. 
Gets the time duration between two consecutive ticks using frequency.

Overrides:
getInterarrivalTime in class RelativeTime
Returns:
the interarrival time

getInterarrivalTime

public RelativeTime getInterarrivalTime(RelativeTime destination)
Deprecated. 
Gets the time duration between two consecutive ticks using frequency.

Overrides:
getInterarrivalTime in class RelativeTime
Parameters:
destination - the destination for the interarrival-time

set

public void set(long millis,
                int nanos)
Deprecated. 
Change the indicated interval of this to the sum of the values of the arguments.

Overrides:
set in class HighResolutionTime
Parameters:
millis - the millisecond component.
nanos - the nanosecond component.
Throws:
IllegalArgumentException - if any of the argument is negative.

setFrequency

public void setFrequency(int frequency)
Deprecated. 
Set the frequency of this.

Parameters:
frequency - the frequency value.
Throws:
ArithmeticException - if the frequency is not positive.

absolute

public AbsoluteTime absolute(Clock clock,
                             AbsoluteTime destination)
Deprecated. 
The RTSJ isn't clear what we should do here; a "conversion" from RationalTime to AbsoluteTime doesn't really make sense. This method just puts the current time (according to the clock) into the destination argument.

Overrides:
absolute in class RelativeTime
Parameters:
clock - the Clock to use; if null, use the Clock returned by Clock.getRealtimeClock().
destination - the destination; if null, allocates a new AbsoluteTime object
Returns:
destination if it isn't null; otherwise the newly-allocated AbsoluteTime


jRate is developed and maintained by the jRate project development team.
Copyright (c) 2001-2006 Angelo Corsaro and Morgan Deters.