reservations
Class ReservationRequestGenerator

java.lang.Object
  |
  +--reservations.ReservationRequestGenerator
All Implemented Interfaces:
java.util.Iterator

public final class ReservationRequestGenerator
extends java.lang.Object
implements java.util.Iterator

A helper class to generate ReservationRequest objects that can be used with Flights and Itineraries.


Constructor Summary
ReservationRequestGenerator()
          Create an object that generates ReservationRequests using the default set of built-in names for input.
ReservationRequestGenerator(java.lang.String filename)
          Create an object that generates ReservationRequests using the specified file as the source of passenger names.
ReservationRequestGenerator(java.net.URL url)
          Create an object that generates ReservationRequests using the indicated URL as the source of names.
 
Method Summary
 boolean hasNext()
          Returns true if there are more ReservationRequests.
 java.util.Iterator iterator()
          Returns an Iterator over the current set of ReservationRequests.
 java.lang.Object next()
          Returns the next ReservationRequest
 ReservationRequest nextRequest()
          Returns the next ReservationRequest object.
 void remove()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ReservationRequestGenerator

public ReservationRequestGenerator()
                            throws java.io.IOException
Create an object that generates ReservationRequests using the default set of built-in names for input.

If the system property "infoRequests" is set, the resulting ReservationRequestGenerator will enable a mechanism to make information requests back to Flight and Reservation objects previously generated.

System property values can be set on the java command line:

 java -DinfoRequests=true ...
 


ReservationRequestGenerator

public ReservationRequestGenerator(java.net.URL url)
                            throws java.io.IOException
Create an object that generates ReservationRequests using the indicated URL as the source of names.

If the system property "infoRequests" is set, the resulting ReservationRequestGenerator will enable a mechanism to make information requests back to Flight and Reservation objects previously generated.

System property values can be set on the java command line:

 java -DinfoRequests=true ...
 


ReservationRequestGenerator

public ReservationRequestGenerator(java.lang.String filename)
                            throws java.io.FileNotFoundException
Create an object that generates ReservationRequests using the specified file as the source of passenger names.

If the system property "infoRequests" is set, the resulting ReservationRequestGenerator will enable a mechanism to make information requests back to Flight and Reservation objects previously generated.

System property values can be set on the java command line:

 java -DinfoRequests=true ...
 

Method Detail

nextRequest

public ReservationRequest nextRequest()
Returns the next ReservationRequest object.

Returns:
the next ReservationRequest or null if none are available.

iterator

public java.util.Iterator iterator()
Returns an Iterator over the current set of ReservationRequests. Note this isn't a true Iterator in that one can't obtain multiple, independent iterations over the same set of ReservationRequests.


hasNext

public boolean hasNext()
Returns true if there are more ReservationRequests.

Specified by:
hasNext in interface java.util.Iterator

next

public java.lang.Object next()
Returns the next ReservationRequest

Specified by:
next in interface java.util.Iterator
Returns:
the next element in the iteration.
Throws:
java.util.NoSuchElementException - if iteration has no more elements.

remove

public void remove()
Specified by:
remove in interface java.util.Iterator