jbotrace.base
Class Race

java.lang.Object
  |
  +--jbotrace.base.Race
All Implemented Interfaces:
java.lang.Runnable

public class Race
extends java.lang.Object
implements java.lang.Runnable

Description: Contains the information for a race.


Constructor Summary
Race()
          Constructs a new race.
Race(Track track, java.util.List driverList, int laps)
          Contructs a new race.
 
Method Summary
 java.util.List getCarList()
          Returns the list of cars running in the race.
 int getCarNumber()
          Returns the number of cars in this race
 update.Updater getDisplayUpdater()
          Returns the DisplayUpdater.
 update.Updater getNewRaceUpdater()
          Returns the newRaceUpdater.
 java.util.List getPositionList()
          Returns the list with the cars in the current race order
 update.Updater getStatisticsUpdater()
          Returns the StatisticsUpdater.
 int getTime()
          Return the current race time
 Track getTrack()
          Returns the track of the race.
 void newRace(Track track, java.util.List driverList, int laps)
          Resets the race.
 void run()
          The implementation of Runnable.
 void setCarsToStart()
          Set cars to start positions.
 void setTrack(Track track)
          Sets the track.
 void startRaceThread()
          Start race thread.
 void stopRaceThread()
          Stop race thread.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Race

public Race()
Constructs a new race.


Race

public Race(Track track,
            java.util.List driverList,
            int laps)
Contructs a new race.

Method Detail

newRace

public void newRace(Track track,
                    java.util.List driverList,
                    int laps)
Resets the race. This method is much easier than creating a new race object and updating all UpdateListeners.


getCarList

public java.util.List getCarList()
Returns the list of cars running in the race.


getCarNumber

public int getCarNumber()
Returns the number of cars in this race


getDisplayUpdater

public update.Updater getDisplayUpdater()
Returns the DisplayUpdater.


getNewRaceUpdater

public update.Updater getNewRaceUpdater()
Returns the newRaceUpdater.


getPositionList

public java.util.List getPositionList()
Returns the list with the cars in the current race order


getStatisticsUpdater

public update.Updater getStatisticsUpdater()
Returns the StatisticsUpdater.


getTime

public int getTime()
Return the current race time


getTrack

public Track getTrack()
Returns the track of the race.


run

public void run()
The implementation of Runnable.

Specified by:
run in interface java.lang.Runnable

setCarsToStart

public void setCarsToStart()
Set cars to start positions.


setTrack

public void setTrack(Track track)
Sets the track.


startRaceThread

public void startRaceThread()
Start race thread.


stopRaceThread

public void stopRaceThread()
Stop race thread.