Class Route

java.lang.Object
  extended by Route

public class Route
extends Object

A Route keeps track of information about a specific connection from one Airport to another. A route has a departure and arrival Airport, as well as a distance in miles.

Note that flights can be added to a Route, and an Iterator provides access to the flights in order of departure time (earlier flights first).


Field Summary
protected  Airport arrives
          arrival airport
protected  Airport departs
          departure airport
protected  int distance
          distance in miles between airports
protected  OrderedList<Flight> flights
          list of flights, ordered by departure time
 
Constructor Summary
Route(Airport departs, Airport arrives, int distance)
           
 
Method Summary
 void addFlight(Flight f)
           
 Airport arrives()
           
 Airport departs()
           
 int distance()
           
 Iterator<Flight> flights()
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

departs

protected Airport departs
departure airport


arrives

protected Airport arrives
arrival airport


flights

protected OrderedList<Flight> flights
list of flights, ordered by departure time


distance

protected int distance
distance in miles between airports

Constructor Detail

Route

public Route(Airport departs,
             Airport arrives,
             int distance)
Method Detail

departs

public Airport departs()

arrives

public Airport arrives()

distance

public int distance()

addFlight

public void addFlight(Flight f)

flights

public Iterator<Flight> flights()

toString

public String toString()
Overrides:
toString in class Object