|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectscheduler.TravelDivisionsConnectionsFinder
A class used to find connections for the given set of travel parts.
Field Summary | |
private ChangesJudger |
changesJudger
A judger of changes. |
private boolean |
fRevert
Indicates whether the search is performed with the arrival time limit (then everything is reverted). |
private ConnectionsTravelInfoProvider |
infoProvider
A provider of the travel information on the world. |
static int |
MAX_ALTER_CHANGE_CONNECTIONS_COUNT
Defines a maximal number of change connections when searching for some other changes if there where none matching the travel constraints, but there are still some with a change time longer then the max change time. |
static int |
MAX_LENGTH_TAXI_RESERVED_TIME
Defines a minimal duration in minutes of the taxi travel part of the maximal possible length. |
static int |
MAX_LENGTH_WALK_RESERVED_TIME
Defines a minimal duration in minutes of the walk travel part of the maximal possible length. |
static int |
MAX_STARTING_CONNECTIONS_COUNT
Defines a maximal number of connections taken into account when starting the search for the connections leaving from the first station of the whole travel. |
private ConnectionsFinderTasksManager |
tasksManager
A tasks manager. |
private TravelConstraints |
travelConstraint
The travel constraint to be applied. |
Constructor Summary | |
TravelDivisionsConnectionsFinder()
Constructor. |
Method Summary | |
private void |
DropTasksBreakingConstraints(java.util.ArrayList tasksList)
Removes from the given list of tasks those that break the constraints. |
java.util.ArrayList |
FindConnections(java.util.ArrayList travelDivisionsList,
TravelConstraints travelConstraints)
Finds connections for each of the given travel divisions. |
private void |
FindConnections(TravelPartsList travelPartsList,
java.util.Date departureLimit,
java.util.Date arrivalLimit,
java.util.ArrayList resultsList)
Finds out connections for the given division of the travel matching the given time limits and other constraints. |
private java.util.ArrayList |
GetChangeConnections(int meanOfTransportation,
Station changeStation,
Station destinationStation,
java.util.Date changeStartTime,
java.util.Date arrivalLimit,
java.lang.Boolean fTooLongChangesExist)
Gets a list of all connections leaving from the given station not before the given change time and holding the change constraints. |
private java.util.ArrayList |
GetDeparturingConnections(int meanOfTransportation,
Station station,
Station destinationStation,
java.util.Date departureLimit,
java.util.Date arrivalLimit,
int connectionsCountLimit)
Gets a list of at most connectionsCountLimit possible connections leaving from the given station not before the given time limit with the minimal time spans between the time limit and the departure time. |
private static int |
GetTaxiDriveReservationTime(TravelPartConnectionChunk chunk)
Gets an amount of time in minutes needed to be reserved for the given taxi connection chunk for the drive only. |
private static int |
GetWalkReservationTime(TravelPartConnectionChunk chunk)
Gets an amount of time in minutes needed to be reserved for the given walk connection chunk. |
private boolean |
IsDirectConnection(int currentStationIndex,
int destinationStationIndex)
Checks whether a connection is a driect connection basing on the indecies of the current and destination stations'. |
private void |
RemoveSimilarSolutions(java.util.ArrayList solutionsList)
Removes from the given list of solutions similar ones (with the same routes and time of start and end, but with different times between the start and the end). |
void |
SetChangesJudger(ChangesJudger changesJudger)
Sets the judger of changes. |
void |
SetTasksManager(ConnectionsFinderTasksManager tasksManager)
Sets the tasks manager. |
void |
SetTravelInfoProvider(ConnectionsTravelInfoProvider infoProvider)
Sets the provider of the travel information on the world. |
private void |
SolveUnsetDates(java.util.ArrayList tasksList,
java.util.Date departureLimit,
java.util.Date arrivalLimit)
Sets the start and end dates for all the connection chunks with unset dates. |
private void |
UpdateTaxiConnectionChunksDates(java.util.ArrayList routes)
Shortens the duration of the taxi connection chunks so there will be time for a change. |
private boolean |
WillBeBeforeDate(java.util.Date date,
int shift,
java.util.Date dateLimit)
Checks if the given date shifted by the given number of minutes will be before the given date limit. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private ConnectionsTravelInfoProvider infoProvider
private boolean fRevert
private TravelConstraints travelConstraint
private ChangesJudger changesJudger
private ConnectionsFinderTasksManager tasksManager
public static final int MAX_LENGTH_WALK_RESERVED_TIME
public static final int MAX_LENGTH_TAXI_RESERVED_TIME
public static final int MAX_STARTING_CONNECTIONS_COUNT
public static final int MAX_ALTER_CHANGE_CONNECTIONS_COUNT
Constructor Detail |
public TravelDivisionsConnectionsFinder()
Method Detail |
public void SetTravelInfoProvider(ConnectionsTravelInfoProvider infoProvider)
infoProvider
- A provider to be set.public java.util.ArrayList FindConnections(java.util.ArrayList travelDivisionsList, TravelConstraints travelConstraints)
travelDivisionsList
- A list of travel divisions to receive the results. It must be empty.travelConstraints
- The travel constraints to be applied.
private void RemoveSimilarSolutions(java.util.ArrayList solutionsList)
solutionsList
- A list of solutions to be cleaned of similar solutions.private void FindConnections(TravelPartsList travelPartsList, java.util.Date departureLimit, java.util.Date arrivalLimit, java.util.ArrayList resultsList)
travelPartsList
- A division of the travel to search for the connections for.departureLimit
- A departure time limit.arrivalLimit
- An arrival time limit. Set it to null if there is no arrival limit.resultsList
- A list to store all the results in.private void UpdateTaxiConnectionChunksDates(java.util.ArrayList routes)
routes
- A list of tasks to be updated.public void SetChangesJudger(ChangesJudger changesJudger)
changesJudger
- A judger of changes to be used.public void SetTasksManager(ConnectionsFinderTasksManager tasksManager)
tasksManager
- A tasks manager to be used.private void DropTasksBreakingConstraints(java.util.ArrayList tasksList)
tasksList
- A list of tasks to be checked.private void SolveUnsetDates(java.util.ArrayList tasksList, java.util.Date departureLimit, java.util.Date arrivalLimit)
tasksList
- A list of tasks for which to set dates for its connection tasks.departureLimit
- A departure date limit.arrivalLimit
- An arrival date limit. Set it to null if there is no limit.private static int GetWalkReservationTime(TravelPartConnectionChunk chunk)
chunk
- A connection chunk for which the time is being reserved.
private static int GetTaxiDriveReservationTime(TravelPartConnectionChunk chunk)
chunk
- A connection chunk for which the time is being reserved.
private java.util.ArrayList GetDeparturingConnections(int meanOfTransportation, Station station, Station destinationStation, java.util.Date departureLimit, java.util.Date arrivalLimit, int connectionsCountLimit)
meanOfTransportation
- A mean of transportation the connections are to be taken by.station
- An origin station the connections are to leave from.destinationStation
- A destination station. If there are direct connections the will be, each of them will be on the list even if that would mean breaking the count limit.departureLimit
- A departure date limit. Connections must not depart from the given station before / after (depends on reverting) this date.arrivalLimit
- An arrival time limit. Connections must not depart from the given station before this date. Set it to null if not reverting.connectionsCountLimit
- A maximal number of connections to be returned.
private boolean WillBeBeforeDate(java.util.Date date, int shift, java.util.Date dateLimit)
date
- A date to be shifted. The given parameter will not be modified.shift
- A number of minutes to shift the date by. It must not be positive.dateLimit
- A date that is limiting the result date from below.
private java.util.ArrayList GetChangeConnections(int meanOfTransportation, Station changeStation, Station destinationStation, java.util.Date changeStartTime, java.util.Date arrivalLimit, java.lang.Boolean fTooLongChangesExist)
meanOfTransportation
- A mean of transportation the connections are to be taken by.changeStation
- A station the connections are to leave from.destinationStation
- A destination station. The best direct change that does not hold the change time constraints will be added to the list of changes unless some other direct change holding the constrains will be added.changeStartTime
- A time since when the change connections may leave.arrivalLimit
- An arrival limit. Set it only if reverting.fTooLongChangesExist
- After a call to this method this will hold a boolean value indicating whether there were changes with the change time longer then the one allowed by the constraints.
private boolean IsDirectConnection(int currentStationIndex, int destinationStationIndex)
currentStationIndex
- An index of the cuurent station within a connection.destinationStationIndex
- An index of the destination station within a connection.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |