|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object airline.Flight.Ticket
public class Flight.Ticket
For each passenger on the flight, there is an underlying Ticket
that is used to track the seating assignment for the passenger on the flight
as well as to trace this passenger back to an original Reservation
.
Field Summary | |
---|---|
private Reservation |
resv
The underlying reservation for the purchase of this seat. |
private String |
seat
Seat assignment. |
private int |
travelerNum
An index for the individual traveler, relative to Reservation.getTravelers(). |
Constructor Summary | |
---|---|
private |
Flight.Ticket(Reservation res,
int traveler,
String seat)
Initialize an underlying seat assignment that will be given as a reference to the Reservation when booking the seat. |
Method Summary | |
---|---|
void |
cancel()
Officially removes the underlying traveler from the given flight. |
Flight |
getFlight()
Returns a reference to the associated Flight . |
String |
getSeat()
Returns the string representation of the seat (e.g., "28C"). |
String |
getTravelerName()
Returns the name of the traveler for this ticket. |
boolean |
requestSeatChange(String seatDesignator)
Requests a seat change from the existing assignment to the designated seat. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private Reservation resv
private String seat
private int travelerNum
Constructor Detail |
---|
private Flight.Ticket(Reservation res, int traveler, String seat)
res
- Reference to the underling Reservation
holding this seattraveler
- Index into the array of travelers on given reservationseat
- Seat designation (e.g., "28C"); assumed to be validMethod Detail |
---|
public void cancel() throws IllegalArgumentException
IllegalArgumentException
- if the Ticket
was invalid (for example, if previously removed from flight)public Flight getFlight()
Flight
.
Flight
instance.public String getSeat()
public String getTravelerName()
public boolean requestSeatChange(String seatDesignator) throws IllegalArgumentException
seatDesignator
- String representation for desired seat (e.g., "28C")
true
if request accepted; false
otherwise (e.g., if that seat is unavailable)
IllegalArgumentException
- if seatDesignator
is invalid for the flight's seating configuration.
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |