Package com.uca.flights
Class Flight
- java.lang.Object
-
- com.uca.flights.Flight
-
public class Flight extends java.lang.ObjectRepresent flight
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddBooking(Booking booking)Add a booking to the flightvoiddelay(java.time.Duration duration)Delay the duration from another durationvoiddelay(java.time.Duration duration, Jump j)Delay the duration from another duration from a specific jumpvoiddelay(java.time.Duration duration, Step s)Delay the duration from another duration from a specific stepjava.time.ZonedDateTimegetArrival()Getterjava.util.List<Booking>getBookings()Getterjava.time.ZonedDateTimegetDeparture()GetterAirportgetDestination()Getterjava.time.DurationgetDuration()GetterFlightIdgetId()Getterjava.util.Iterator<Jump>getJumps()GetterAirportgetStartingAirport()Getterjava.util.Iterator<Step>getSteps()GetterbooleanisReservable()GettervoidremoveBooking(Booking booking)Add a booking to the flightjava.lang.StringtoString()Redefinition of toString
-
-
-
Method Detail
-
getId
public FlightId getId()
Getter- Returns:
- the flight identifier
-
getDeparture
public java.time.ZonedDateTime getDeparture()
Getter- Returns:
- the flight departure date
-
getArrival
public java.time.ZonedDateTime getArrival()
Getter- Returns:
- the flight arrival date
-
getDestination
public Airport getDestination()
Getter- Returns:
- the flight last airport
-
getStartingAirport
public Airport getStartingAirport()
Getter- Returns:
- the flight first airport
-
getDuration
public java.time.Duration getDuration()
Getter- Returns:
- the duration of the flight
-
getBookings
public java.util.List<Booking> getBookings()
Getter- Returns:
- a shallow copy of the list of booking concerning this
-
addBooking
public void addBooking(Booking booking)
Add a booking to the flight- Parameters:
booking- the booking- Throws:
java.lang.IllegalArgumentException- on null parameter, or booking for another flight
-
removeBooking
public void removeBooking(Booking booking)
Add a booking to the flight- Parameters:
booking- the booking- Throws:
java.lang.IllegalArgumentException- on null parameter, or booking for another flight
-
isReservable
public boolean isReservable()
Getter- Returns:
- if flight is reservable
-
delay
public void delay(java.time.Duration duration)
Delay the duration from another duration- Parameters:
duration- the duration- Throws:
java.lang.IllegalArgumentException- on null parameter
-
delay
public void delay(java.time.Duration duration, Jump j)Delay the duration from another duration from a specific jump- Parameters:
duration- the durationj- the jump- Throws:
java.lang.IllegalArgumentException- on null parameter
-
delay
public void delay(java.time.Duration duration, Step s)Delay the duration from another duration from a specific step- Parameters:
duration- the durations- the step- Throws:
java.lang.IllegalArgumentException- on null parameter
-
getSteps
public java.util.Iterator<Step> getSteps()
Getter- Returns:
- the first step
-
getJumps
public java.util.Iterator<Jump> getJumps()
Getter- Returns:
- the first jump
-
toString
public java.lang.String toString()
Redefinition of toString- Overrides:
toStringin classjava.lang.Object- Returns:
- a string with starting and last airport and duration in hours
-
-