|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object airline.AirlineSystem
public class AirlineSystem
The AirlineSystem manages the overall set of databases for users, flights, and reservations.
Constructor Summary | |
---|---|
AirlineSystem()
Create a new AirlineSystem . |
Method Summary | |
---|---|
void |
addFlight(Flight f)
Adds a Flight to the system. |
void |
addUser(User usr)
Adds a User to the system. |
void |
ExportData(ObjectOutputStream oos)
Serialize the entire AirlineSystem to an output stream. |
Iterator<Flight> |
getAllFlights()
Returns an array of all flights currently in the system. |
Iterator<User> |
getAllUsers()
Returns an array of all flights currently in the system. |
Flight |
getFlight(String flightCode)
Returns the Flight with the given flight code (e.g., "UA200"). |
User |
getUser(String ID)
Returns the User associated with the given ID. |
void |
ImportData(ObjectInputStream ois)
Load a previously exported version of the AirlineSystem. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public AirlineSystem()
AirlineSystem
.
System initially has a single administrative user with
credentials: username="admin", password="secret"
Method Detail |
---|
public void addFlight(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 void addUser(User usr) throws IllegalArgumentException
User
to the system.
The caller is responsible for ensuring that the new customer has been properly configured
prior to entry into the system.
usr
- the new User
IllegalArgumentException
- if system has existing customer with same ID.public void ExportData(ObjectOutputStream oos) throws IOException
oos
- An ObjectOutputStream
such as a FileOutputStream
.
IOException
public Iterator<Flight> getAllFlights()
public Iterator<User> getAllUsers()
public Flight getFlight(String flightCode)
Flight
with the given flight code (e.g., "UA200").
If no such flight exists, returns null.
flightCode
- a flight code (e.g., "UA200")
public User getUser(String ID)
ID
- The customer ID
User
instance; null if ID not found.public void ImportData(ObjectInputStream ois) throws IOException, ClassNotFoundException
ois
- An open ObjectInputStream
such as a FileInputStream
.
IOException
ClassNotFoundException
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |