reservations
Class ItineraryReader

java.lang.Object
  |
  +--reservations.ItineraryReader

public class ItineraryReader
extends java.lang.Object

A helper class designed to read a file of flight destinations


Constructor Summary
ItineraryReader()
          Creates an object that reads Itinerary information from the default input source.
ItineraryReader(java.lang.String filename)
          Creates an object that reads Itinerary information from the named file.
ItineraryReader(java.net.URL url)
          Creates an object that reads Itinerary information from the indicated URL.
 
Method Summary
 java.util.Iterator iterator()
          Returns an Iterator for the set of Itineraries being read by the ItineraryReader.
 Itinerary nextItinerary()
          Returns the next Itinerary object from the input source.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ItineraryReader

public ItineraryReader()
                throws java.io.IOException
Creates an object that reads Itinerary information from the default input source.


ItineraryReader

public ItineraryReader(java.net.URL url)
                throws java.io.IOException
Creates an object that reads Itinerary information from the indicated URL.


ItineraryReader

public ItineraryReader(java.lang.String filename)
                throws java.io.FileNotFoundException
Creates an object that reads Itinerary information from the named file.

Method Detail

nextItinerary

public Itinerary nextItinerary()
Returns the next Itinerary object from the input source. Returns null when no more Itinerary objects are available. records in the destination file have the following structure: # optional comment lines begin with a # character starting airport description line destination airport description line I let the getAirport convenience method differentiate between comment lines and airport description lines; as long as getAirport returns an Airport object for each, they get paired up as an Itinerary.


iterator

public java.util.Iterator iterator()
Returns an Iterator for the set of Itineraries being read by the ItineraryReader.