// Archibald Haddock (123456789)
// COMP 202-A, Section 0 (Fall 2007)
// Instructor: Cuthbert Calculus
// Assignment 0, Question 0

/**
 * A <code>CyclistTrack</code> object keeps track of the status of a
 * <code>Cyclist</code> within a race. The parameters it keeps track of are
 * the number of laps the <code>Cyclist</code> has completed, and the total time
 * elapsed since the <code>Cyclist</code> started the race.
 */
public class CyclistTracker {
	private int lapsCompleted;
	private double totalTime;

	/**
	 * Constructs a new <code>CyclistTracker</code> which represents the status
	 * of a <code>Cyclist</code> who has not yet started the race.
	 */
	public CyclistTracker() {
		this.reset();
	}

	/**
	 * Resets the <code>CyclistTracker</code> by setting the number of laps
	 * completed and the time elpased since the race started to 0.
	 */
	public void reset() {
		this.lapsCompleted = 0;
		this.totalTime = 0;
	}

	/**
	 * Notes that the <code>Cyclist</code> whose status is being tracked by this
	 * <code>CyclistTracker</code> has completed one more lap.
	 */
	public void completeLap() {
		this.lapsCompleted++;
	}

	/**
	 * Returns the number of laps completed by the <code>Cyclist</code> whose
	 * status is being tracked by this <code>CyclistTracker</code>.
	 * @return the number of laps completed by the associated
	 *         <code>Cyclist</code>
	 */
	public int getLapsCompleted() {
		return this.lapsCompleted;
	}
	
	/**
	 * Returns the total time elapsed since the <code>Cyclist</code> whose
	 * status is being tracked by this <code>CyclistTracker</code> object has
	 * started the race.
	 * @return the total time elapsed since the associated <code>Cyclist</code>
	 *         started the race.
	 */
	public double getTotalTime() {
		return this.totalTime;
	}
	
	/**
	 * Adds to the amount of time elapsed since the <code>Cyclist</code> whose
	 * status is being tracked by this <code>CyclistTracker</code> started the
	 * race.
	 * @param time the amount of time to add to the total time elapsed since the
	 *        associated <code>Cyclist</code> started the race. 
	 */
	public void addTime(double time) {
		this.totalTime += time;
	}
}
