aicas logoJamaicaVM 3.2 rel 62
RTSJ Implementation

javax.realtime
Class AbsoluteTime

java.lang.Object
  extended by javax.realtime.HighResolutionTime
      extended by javax.realtime.AbsoluteTime
All Implemented Interfaces:
java.lang.Comparable

public class AbsoluteTime
extends HighResolutionTime

Jamaica Realtime Specification for Java class AbsoluteTime.

This class represents an absoulte point in the time represented by a Clock.


Constructor Summary
AbsoluteTime()
          Constructor to create absolute time 0ms, 0ns.
AbsoluteTime(AbsoluteTime time)
          Constructor to create an absoulte time with millis and nanos taken from an existing absolute time.
AbsoluteTime(AbsoluteTime time, Clock clock)
          Constructor to create an absoulte time with millis and nanos taken from an existing absolute time.
AbsoluteTime(Clock clock)
          Constructor to create absolute time 0ms, 0ns with given clock association.
AbsoluteTime(java.util.Date date)
          Constructor to create an absolute time from a time represented by an instance of Date.
AbsoluteTime(java.util.Date date, Clock clock)
          Constructor to create an absolute time from a time represented by an instance of Date.
AbsoluteTime(long millis, int nanos)
          Constructor to create an absolute time from given milli and nano seconds. nanos should be positive.
AbsoluteTime(long millis, int nanos, Clock clock)
          Constructor to create an absolute time from given milli and nano seconds. nanos should be positive.
 
Method Summary
 AbsoluteTime absolute(Clock clock)
          absolute implements abstract method inherited from HighResolutionTime. absolute converts this time to an absolute time relative to the given clock.
 AbsoluteTime absolute(Clock clock, AbsoluteTime dest)
          absolute implements abstract method inherited from HighResolutionTime.
 AbsoluteTime add(long millis, int nanos)
          add adds time given in milliseconds and nanoseconds to this absolute time.
 AbsoluteTime add(long millis, int nanos, AbsoluteTime dest)
          add adds time given in milliseconds and nanoseconds to this absolute time.
 AbsoluteTime add(RelativeTime time)
          add adds interval given as RelativeTime instance to this absolute time.
 AbsoluteTime add(RelativeTime time, AbsoluteTime dest)
          add adds interval given as RelativeTime instance to this absolute time.
 java.util.Date getDate()
          getDate converst this absolute time to an instance of Date that represents the same time.
 RelativeTime relative(Clock clock)
          relative implements abstract method inherited from HighResolutionTime. relative returns a new relative time object for this relative to the given clock.
 RelativeTime relative(Clock clock, RelativeTime dest)
          relative implements abstract method inherited from HighResolutionTime. relative returns a new relative time object for this relative to the given clock.
 void set(java.util.Date date)
          set sets the time represented by this to the time represented by an instance of Date.
 RelativeTime subtract(AbsoluteTime time)
          subtract substracts another absolute time from this absolute time.
 RelativeTime subtract(AbsoluteTime time, RelativeTime dest)
          subtract substracts another absolute time from this absolute time.
 AbsoluteTime subtract(RelativeTime time)
          subtract substracts an interval given as an instance of RelativeTime from this.
 AbsoluteTime subtract(RelativeTime time, AbsoluteTime dest)
          subtract substracts an interval given as an instance of RelativeTime from this.
 java.lang.String toString()
          toString converst this to a String
 
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

AbsoluteTime

public AbsoluteTime()
Constructor to create absolute time 0ms, 0ns.


AbsoluteTime

public AbsoluteTime(AbsoluteTime time)
Constructor to create an absoulte time with millis and nanos taken from an existing absolute time. Use time.getClock() as associated clock.

Parameters:
time - the original absolute time, must not be null.

AbsoluteTime

public AbsoluteTime(java.util.Date date)
Constructor to create an absolute time from a time represented by an instance of Date. Use the realtime clock as associated clock.

Parameters:
date - the original Date, must not be null.

AbsoluteTime

public AbsoluteTime(long millis,
                    int nanos)
Constructor to create an absolute time from given milli and nano seconds. nanos should be positive.

ensure

   (this.getMilliseconds() == millis, 
    this.getNanosecondes() == nanos); 
 

Parameters:
millis - the milliseconds value for the new absolute time.
nanos - the nanoseconds value for the new absolute time.

AbsoluteTime

public AbsoluteTime(Clock clock)
Constructor to create absolute time 0ms, 0ns with given clock association.

Parameters:
clock - the clock to be associated with this time, Clock.getRealtimeClock if null.

AbsoluteTime

public AbsoluteTime(AbsoluteTime time,
                    Clock clock)
Constructor to create an absoulte time with millis and nanos taken from an existing absolute time. Use given clock association.

Parameters:
time - the original absolute time, must not be null.
clock - the clock to be associated with this time, Clock.getRealtimeClock if null.

AbsoluteTime

public AbsoluteTime(java.util.Date date,
                    Clock clock)
Constructor to create an absolute time from a time represented by an instance of Date. Use given clock association.

Parameters:
date - the original Date, must not be null.
clock - the clock to be associated with this time, Clock.getRealtimeClock if null.

AbsoluteTime

public AbsoluteTime(long millis,
                    int nanos,
                    Clock clock)
Constructor to create an absolute time from given milli and nano seconds. nanos should be positive. Use given clock association.

ensure

   (this.getMilliseconds() == millis, 
    this.getNanosecondes() == nanos); 
 

Parameters:
millis - the milliseconds value for the new absolute time.
nanos - the nanoseconds value for the new absolute time.
clock - the clock to be associated with this time, Clock.getRealtimeClock if null.
Method Detail

absolute

public AbsoluteTime absolute(Clock clock,
                             AbsoluteTime dest)
absolute implements abstract method inherited from HighResolutionTime. It converts this time to an absolute time relative to the given clock. Use a preallocated AbsoluteTime object if present.

For AbsoluteTime, the result is this iff dest is null.

Specified by:
absolute in class HighResolutionTime
Parameters:
clock - The clock the result should be relative to.
dest - The preallocated AbsoluteTime object to hold the result. May be null to indicate that a new object should be allocated.
Returns:
dest, if dest is not null, this otherwise.

absolute

public AbsoluteTime absolute(Clock clock)
absolute implements abstract method inherited from HighResolutionTime. absolute converts this time to an absolute time relative to the given clock.

For AbsoluteTime, the result is this iff dest is null.

Specified by:
absolute in class HighResolutionTime
Parameters:
clock - The clock the result should be relative to.
Returns:
this or a new object allocated from the current memory area for the absolute time.

add

public AbsoluteTime add(long millis,
                        int nanos)
add adds time given in milliseconds and nanoseconds to this absolute time.

Parameters:
millis - the milliseconds part of the interval to be added.
nanos - the nanoseconds part of the interval to be added.
Returns:
a new instance of AbsoluteTime of the time of this plus the interval millis/nanos.

add

public AbsoluteTime add(long millis,
                        int nanos,
                        AbsoluteTime dest)
add adds time given in milliseconds and nanoseconds to this absolute time.

Parameters:
millis - the milliseconds part of the interval to be added.
nanos - the nanoseconds part of the interval to be added.
dest - The preallocated AbsoluteTime object to hold the result. May be null to indicate that a new object should be allocated.
Returns:
dest, if dest is not null, the newly allocated object otherwise. The result represents that absolute time of this plus the interval millis/nanos.

add

public AbsoluteTime add(RelativeTime time)
add adds interval given as RelativeTime instance to this absolute time.

Parameters:
time - the interval to be added
Returns:
a new instance of AbsoluteTime of the time of this plus the interval time.

add

public AbsoluteTime add(RelativeTime time,
                        AbsoluteTime dest)
add adds interval given as RelativeTime instance to this absolute time.

Parameters:
time - the interval to be added
dest - The preallocated AbsoluteTime object to hold the result. May be null to indicate that a new object should be allocated.
Returns:
dest, if dest is not null, the newly allocated object otherwise. The result represents that absolute time of this plus the interval time.

getDate

public java.util.Date getDate()
getDate converst this absolute time to an instance of Date that represents the same time. Precision is lost in this conversion, the precision of Data is restricted to millisecons.

Returns:
a new instance of Date.

set

public void set(java.util.Date date)
set sets the time represented by this to the time represented by an instance of Date.

Parameters:
date - an instance of Date, must not be null.

subtract

public RelativeTime subtract(AbsoluteTime time)
subtract substracts another absolute time from this absolute time.

Parameters:
time - the other absolute time.
Returns:
a new instance of RelativeTime of the length of the interval between this and time.

subtract

public RelativeTime subtract(AbsoluteTime time,
                             RelativeTime dest)
subtract substracts another absolute time from this absolute time.

Parameters:
time - the other absolute time.
dest - The preallocated RelativeTime object to hold the result. May be null to indicate that a new object should be allocated.
Returns:
dest, if dest is not null, the newly allocated object otherwise. The result represents the interval between this and time.

subtract

public AbsoluteTime subtract(RelativeTime time)
subtract substracts an interval given as an instance of RelativeTime from this.

Parameters:
time - the interval to be substracted.
Returns:
a new instance of AbsoluteTime of the time of this minus the interval time.

subtract

public AbsoluteTime subtract(RelativeTime time,
                             AbsoluteTime dest)
subtract substracts an interval given as an instance of RelativeTime from this.

Parameters:
time - the interval to be substracted.
dest - The preallocated RelativeTime object to hold the result. May be null to indicate that a new object should be allocated.
Returns:
dest, if dest is not null, the newly allocated object otherwise. The result represents the absolute time of this minus the interval time.

toString

public java.lang.String toString()
toString converst this to a String

Overrides:
toString in class java.lang.Object
Returns:
getDate().toString() + " " + millis % 1000 + "ms " + nanos + "ns"

relative

public RelativeTime relative(Clock clock)
relative implements abstract method inherited from HighResolutionTime. relative returns a new relative time object for this relative to the given clock.

Specified by:
relative in class HighResolutionTime
Parameters:
clock - The clock the result should be relative to.
Returns:
a new RelativeTime object.

relative

public RelativeTime relative(Clock clock,
                             RelativeTime dest)
relative implements abstract method inherited from HighResolutionTime. relative returns a new relative time object for this relative to the given clock.

Specified by:
relative in class HighResolutionTime
Parameters:
clock - The clock the result should be relative to.
dest - The preallocated RelativeTime object to hold the result. May be null to indicate that a new object should be allocated.
Returns:
time, if time is not null, the newly allocated object otherwise.

aicas logoJamaicaVM 3.2 rel 62
RTSJ Implementation

aicas GmbH, Karlsruhe - Germany    www.aicas.com
Copyright 2001-2008 aicas GmbH. All Rights Reserved.