* @param showIntermediateStops Whether to include intermediate stops in the itinerary or not
* @return The generated itinerary
*/
public Itinerary generateItinerary(GraphPath path, boolean showIntermediateStops) {
if (path.states.size() < 2) {
throw new TrivialPathException();
}
Itinerary itinerary = new Itinerary();
State[] states = new State[path.states.size()];