001package edu.pdx.cs410J; 002 003import java.io.Serializable; 004import java.util.Collection; 005 006/** 007 * This class represents an airline. Each airline has a name and 008 * consists of multiple flights. 009 */ 010public abstract class AbstractAirline<T extends AbstractFlight> implements Serializable 011{ 012 013 /** 014 * Returns the name of this airline. 015 */ 016 public abstract String getName(); 017 018 /** 019 * Adds a flight to this airline. 020 */ 021 public abstract void addFlight(T flight); 022 023 /** 024 * Returns all of this airline's flights. 025 */ 026 public abstract Collection<T> getFlights(); 027 028 /** 029 * Returns a brief textual description of this airline. 030 */ 031 public final String toString() { 032 return this.getName() + " with " + this.getFlights().size() + 033 " flights"; 034 } 035 036}