sdr 0.7

net.cscott.sdr.calls
Class Timed<T extends Timed<T>>

java.lang.Object
  extended by net.cscott.sdr.calls.Timed<T>
All Implemented Interfaces:
Comparable<T>
Direct Known Subclasses:
TimedAction, TimedFormation, TimedPosition

public abstract class Timed<T extends Timed<T>>
extends Object
implements Comparable<T>

Abstract superclass for TimedAction, TimedPosition, and TimedFormation, which pair a Action, Position, or Formation with a specific time at which it occurs.

Author:
C. Scott Ananian

Field Summary
 boolean isAbsolute
          Whether times are absolute, or relative to the previous Timed.
 Fraction time
          If isAbsolute is true, then the absolute time at which this formation should appear.
 
Constructor Summary
protected Timed(Fraction time, boolean isAbsolute)
           
 
Method Summary
 int compareTo(T t)
          Timeds are compared to each other on the basis of their time fields.
static
<T extends Timed<T>>
List<T>
makeAbsolute(List<T> l)
          Take a list of possibly-relative times and make them all absolute.
abstract  T makeAbsolute(Timed<?> reference)
          Given a reference, make this Timed absolute.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

time

public final Fraction time
If isAbsolute is true, then the absolute time at which this formation should appear. Otherwise, the relative amount of time after the previous Timed at which this formation should appear.


isAbsolute

public final boolean isAbsolute
Whether times are absolute, or relative to the previous Timed.

Constructor Detail

Timed

protected Timed(Fraction time,
                boolean isAbsolute)
Method Detail

compareTo

public int compareTo(T t)
              throws IllegalArgumentException
Timeds are compared to each other on the basis of their time fields. Earlier Timeds are before later ones.

Specified by:
compareTo in interface Comparable<T extends Timed<T>>
Throws:
IllegalArgumentException - if the position times are not absolute.

makeAbsolute

public abstract T makeAbsolute(Timed<?> reference)
Given a reference, make this Timed absolute. Returns this if the Timed is already absolute. A null reference should be treated as one with an absolute time of zero.

Parameters:
reference - The previous Timed (must be absolute)

makeAbsolute

public static <T extends Timed<T>> List<T> makeAbsolute(List<T> l)
Take a list of possibly-relative times and make them all absolute. If the first element of the list is not absolute, all times will be taken relative to a reference of zero.


sdr 0.7

Copyright © 2006-2009 C. Scott Ananian