- java.lang.Object
-
- spice.basic.Duration
-
- Direct Known Subclasses:
JEDDuration
,SCLKDuration
,TDBDuration
,TDTDuration
public abstract class Duration extends java.lang.Object
Class Duration is an abstract superclass of all JNISpice types that represent durations. Durations represent relative times: "10 TDB seconds" is an example of a duration; "100 Cassini SCLK ticks" is another example.Durations are associated with specific time systems. JNISpice supports Durations associated with the TDB, TDT, JED, and SCLK time systems.
Durations are used to perform arithmetic with
Time
instances: a Duration can be added to or subtracted from a Time instance. Subtracting one Time instance from another yields a Duration.An object of a given Duration subclass can be added to or subtracted from another duration of the same subclass. Arithmetic on operands of differing duration subclasses is not supported, hence addition and subtraction methods are not declared in Duration itself. See the Duration subclasses
for documentation of their arithmetic methods.Since the rate at which time progresses in one time system may not be constant when measured in another, conversion of Durations between an arbitrary pair of time systems is meaningful only if a reference time is supplied. JNISpice requires the start epoch of a Duration in order to convert the Duration to a given time system.
Version 1.0.0 21-DEC-2009 (NJB)
-
-
Constructor Summary
Constructors Constructor Description Duration()
-
Method Summary
Modifier and Type Method Description abstract double
getMeasure()
Every Duration subclass can return a duration measurement in its native time system.abstract double
getTDBSeconds(Time startTime)
Every Duration subclass must support conversion to a measurement expressed as seconds in the TDB time system.abstract Duration
negate()
Negate a Duration.abstract Duration
scale(double s)
Scale a Duration by the scalar `s'.
-
-
-
Method Detail
-
getTDBSeconds
public abstract double getTDBSeconds(Time startTime) throws SpiceException
Every Duration subclass must support conversion to a measurement expressed as seconds in the TDB time system.Since the relative rates at which time progresses, as measured in different time systems, can be a function of time, converting Durations from one time system to another requires specification of a start epoch. To avoid circular class dependencies, the epoch is specified as a double, not a Time.
Note that this method introduces a circular dependency between the classes
Time
and Duration; this is permitted by the Java language specification (third edition, section 7.3).- Parameters:
startTime
- Time- Returns:
- double
- Throws:
SpiceException
- exeption
-
getMeasure
public abstract double getMeasure() throws SpiceException
Every Duration subclass can return a duration measurement in its native time system.The meaning of the returned value depends on the subclass to which the Duration instance belongs: for TDBDurations the returned value has units of TDB seconds, while for SCLKDurations the returned value is a tick count.
- Returns:
- double
- Throws:
SpiceException
- exeption
-
negate
public abstract Duration negate()
Negate a Duration.- Returns:
- Duration
-
scale
public abstract Duration scale(double s)
Scale a Duration by the scalar `s'.- Parameters:
s
- double- Returns:
- Duration
-
-