All Packages Class Hierarchy This Package Previous Next Index
Class JBMSTours.FlightBuilder
java.lang.Object
|
+----JBMSTours.FlightBuilder
- public class FlightBuilder
- extends Object
Look at the Source.
Build a table of flights that may be useful for a particular tour.
Given three cities, we collect useful flights between each pair of
cities.
- See Also:
- Flight, OneStopFlight, TransferFlight, CreateSchema
-
LAYOVER_TOLERANCE
- Amount of time we're willing to wait on a layover.
-
FlightBuilder(Connection, City, City, City, int)
- Constructs an object that sets up the
FlightObjects table of a particular database for a tour
involving certain cities.
-
FlightBuilder(Connection, City, City, int)
- Constructs an object that sets up the
FlightObjects table of a particular database for flights
between only two particular cities.
-
cleanOutFlightAvailability(Connection)
- Deletes old information from the FlightAvailability table.
-
cleanOutFlightObjects(Connection)
- A static method that deletes stale entries from the flightObjects table.
-
constructFlightObjectTable()
- Extract information on useful flights and store it in the
FlightObjects table.
-
populateTheTable()
- Populate the FlightObjects table.
-
returnAnyFlight(Connection, String, String)
- A static method that finds a flight between two airports.
LAYOVER_TOLERANCE
public static final int LAYOVER_TOLERANCE
- Amount of time we're willing to wait on a layover. Used in
constructing a flight plan when there are no direct flights.
Expressed in hours. Note that 23 hours is probably
unrealistically long.
FlightBuilder
public FlightBuilder(Connection con,
City c1,
City c2,
City c3,
int gi)
- Constructs an object that sets up the
FlightObjects table of a particular database for a tour
involving certain cities.
- Parameters:
- con - A connection to the database
- c1 - The home city
- c2 - The first city to be visited
- c3 - The second city to be visited
- gi - The group_id
FlightBuilder
public FlightBuilder(Connection con,
City c1,
City c2,
int gi)
- Constructs an object that sets up the
FlightObjects table of a particular database for flights
between only two particular cities.
- Parameters:
- con - A connection to the database
- c1 - city 1
- c2 - city 2
- gi - The group_id
constructFlightObjectTable
public void constructFlightObjectTable() throws SQLException, CityChoiceException
- Extract information on useful flights and store it in the
FlightObjects table. The table stores instances of the Flight
class (including its two subclasses). "Useful" flights are
those that fly between pairs of cities in our tour.
- Throws: SQLException
- in case anything goes wrong during a SQL operation
- Throws: CityChoiceException
- if it can't build the tour between requested
cities
populateTheTable
public void populateTheTable() throws SQLException, CityChoiceException
- Populate the FlightObjects table.
- Throws: SQLException
- in case anything goes wrong during an
SQL operation
- Throws: CityChoiceException
- if it can't build the tour
between requested cities
cleanOutFlightAvailability
public static void cleanOutFlightAvailability(Connection con) throws SQLException
- Deletes old information from the FlightAvailability table. The customer
doesn't need to know about the availability of flights that have already passed.
Used in SQL examples and called by archiveData.
There is an alias for this method called cleanOutFlightAvailability.
- Parameters:
- con - connection to the database
- Throws: SQLException
- in case anything goes wrong during a SQL operation
returnAnyFlight
public static Flight returnAnyFlight(Connection con,
String ap1,
String ap2) throws SQLException
- A static method that finds a flight between two airports.
If there are no direct flights, looks for a transfer flights. Uses
stored prepared statements. If there are no transfer flights, it returns
an empty flights object. It doesn't necessarily return the best flight (although
it will always return a direct flight over a transfer flight).
Not used by this class, but available for use in SQL-J statements.
For example, try "VALUES FlightBuilder.returnAnyFlight(getCurrentConnection(),
'SFO', 'MAD').toString()"
- Parameters:
- con - a connection to the databaseid1 First flight id
- ap1 - the first airport code
- ap2 - the second airport code
- Returns:
- Flight a flight
- Throws: SQLException
- in case anything goes wrong during a SQL operation
cleanOutFlightObjects
public static void cleanOutFlightObjects(Connection con) throws SQLException
- A static method that deletes stale entries from the flightObjects table.
Tours that have already started won't need the table anymore!
- Parameters:
- con - a connection to the database
- Throws: SQLException
- in case anything goes wrong during a SQL operation
All Packages Class Hierarchy This Package Previous Next Index