|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object airline.AirlineSystem.FlightDB
private class AirlineSystem.FlightDB
A container of existing Flights
Field Summary | |
---|---|
private HashMap<String,Flight> |
map
We maintain underlying collection as a HashMap |
Constructor Summary | |
---|---|
AirlineSystem.FlightDB()
Creates an initially empty database. |
Method Summary | |
---|---|
void |
add(Flight f)
Adds a Flight to the system. |
Flight |
getFlight(String code)
Returns the Flight associated with the given code. |
Iterator<Flight> |
iterator()
Returns an iterator of Flight instances. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private HashMap<String,Flight> map
Constructor Detail |
---|
public AirlineSystem.FlightDB()
Method Detail |
---|
public void add(Flight f) throws IllegalArgumentException
Flight
to the system.
The caller is responsible for ensuring that the new flight has been properly configured
prior to entry into the system.
f
- the new flight
IllegalArgumentException
- if system has existing flight with same flight number.public Flight getFlight(String code)
Flight
associated with the given code.
Returns null if the code is not found.
code
- The flight code (e.g., "UA200")
Flight
instance; null if code not found.public Iterator<Flight> iterator()
Flight
instances.
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |