org.opentripplanner.model.plan.SortOrder Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of otp Show documentation
Show all versions of otp Show documentation
The OpenTripPlanner multimodal journey planning system
package org.opentripplanner.model.plan;
/**
* OTP sort the returned itineraries according to the request {@code arriveBy} flag. The
* paging may override the sort order.
*/
public enum SortOrder {
/**
* Sort itineraries in order and break ties by:
*
* - Street only - Street only itineraries are sorted before itineraries with transit
*
- Arrival time - Earliest arrival time first
*
- Generalized cost - Lowest cost first
*
- Number of transfers - Lowest number of transfers first
*
- Departure time - Latest departure time first
*
* This is the default for a depart-after search ({@code arriveBy=false}).
*/
STREET_AND_ARRIVAL_TIME,
/**
* Sort itineraries in order and break ties by:
*
* - Street only - Street only itineraries are sorted before itineraries with transit
*
- Departure time - Latest departure time first
*
- Generalized cost - Lowest cost first
*
- Number of transfers - Lowest number of transfers first
*
- Arrival time - Earliest arrival time first
*
* This is the default for an arrive-by search ({@code arriveBy=true}).
*/
STREET_AND_DEPARTURE_TIME;
/**
* The itineraries are sorted with by arrival time with the earliest arrival time first. When
* paging we need to know which end of the list of itineraries we should crop. This method is
* used to decide that together with the current page type (next/previous).
*
* This return {@code true} for the default depart-after search, and {@code false} for an
* arrive-by search.
*/
public boolean isSortedByArrivalTimeAcceding() {
return this == STREET_AND_ARRIVAL_TIME;
}
}