Class Agency

  • All Implemented Interfaces:
    Retailer

    public class Agency
    extends Object
    implements Retailer
    Class for retailers of flights in the flight example.
    Author:
    Herbert Praehofer
    • Field Detail

      • AGENCIES

        public static final Agency[] AGENCIES
        Array with some agency objects
      • name

        public final String name
        The name of the retailer
    • Constructor Detail

      • Agency

        public Agency​(String name)
        Constructor setting the name.
        Parameters:
        name - the name of the agency.
    • Method Detail

      • getOffer

        public Offer getOffer​(Flight flight)
        Returns an offer for a flight.
        Specified by:
        getOffer in interface Retailer
        Parameters:
        flight - the flight
        Returns:
        the offer for the flight
      • findFlight

        public Flight findFlight​(Airline airline,
                                 String from,
                                 String to,
                                 LocalDate date)
        Finds a flight provided by an airline.
        Parameters:
        airline - the airline
        from - the origin of the flight
        to - the destination of the flight
        date - the date of the flight
        Returns:
        the flight object provided by the airline
      • toString

        public String toString()
        Returns a string representation of the agency.
        Overrides:
        toString in class Object
        Returns:
        the string representation