Class Flight


  • public class Flight
    extends java.lang.Object
    Represent flight
    • 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 duration
        j - 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 duration
        s - 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:
        toString in class java.lang.Object
        Returns:
        a string with starting and last airport and duration in hours