Package edu.gwu.algtest
Interface BusConnectionAlgorithm
- All Superinterfaces:
edu.gwu.algtest.Algorithm
public interface BusConnectionAlgorithm
extends edu.gwu.algtest.Algorithm
Interface
BusConnectionAlgorithm
needs to be implemented
by any algorithm that wishes to solve the Bus-Connection problem.-
Method Details
-
analyzeRoutes
In methodanalyzeRoutes()
, you are given a list of buses via theirBusInfo
instances. Here, thebusNumber
andforwardRoute
are given to you. What you need to do is use this to perform some analysis in preparation for finding connections. Alternatively, you can merely store the information and perform all the analysis whenfindConnections()
is called. Also, the buses will be provided in bus-number order so thatbuses[k].busNumber = k
-
findConnections
This method will be called afteranalyzeRoutes()
has been called. The input is a start point on the grid, and an endpoint. Neither need be a bus endpoint nor even a stop point of any bus. If any one of these is not a stop point for any bus OR if a series of bus connections (hence a route) cannot be found, then you returnnull
. Otherwise, there's a route. This is a list ofBusInfo
instances. Here,BusInfo
is used differently. Each instance in sequence is a bus number (which you fill in), and embarkation and disembarkation stops for that bus. The disembarkation point for one bus needs to be an embarkation point for the next bus.
-