public void printRail(Formatter fmt) { // print out the segments first List<RailJourneyRef> journeyKeys = railSolution.getRailJourneyRef(); for (Iterator<RailJourneyRef> iterator = journeyKeys.iterator(); iterator.hasNext(); ) { RailJourneyRef journeyRef = (RailJourneyRef) iterator.next(); // looking the journey by its key RailJourney j = railJourneys.getByRef(journeyRef); printJourney(j, fmt); if (j.getDestination().equals(roundTripTurnaround)) { fmt.format("%s", "\n\n"); } } fmt.format("Total Price %s", railSolution.getTotalPrice()); }
public void printAir(Formatter fmt) { // print out the segments first List<AirSegmentRef> segKeys = airSolution.getAirSegmentRef(); for (Iterator<AirSegmentRef> iterator = segKeys.iterator(); iterator.hasNext(); ) { AirSegmentRef airSegmentRef = (AirSegmentRef) iterator.next(); // looking the leg by its key AirSegment leg = airSegs.getByRef(airSegmentRef); printLeg(leg, fmt); if (leg.getDestination().equals(roundTripTurnaround)) { fmt.format("%s", "\n\n"); } } fmt.format( "Base Price: %s Total Price %s", airSolution.getBasePrice(), airSolution.getTotalPrice()); }
public void printJourney(RailJourney journey, Formatter fmt) { Date dep = Helper.dateFromISO8601(journey.getDepartureTime()); fmt.format( "RAIL (%s) From %s to %s on %Tc\n", journey.getJourneyDirection(), journey.getOriginStationName(), journey.getDestinationStationName(), dep); List<RailSegmentRef> onThisJourney = journey.getRailSegmentRef(); for (Iterator<RailSegmentRef> rsIter = onThisJourney.iterator(); rsIter.hasNext(); ) { RailSegment railSegment = railSegments.get(rsIter.next().getKey()); if (railSegment.getOperatingCompany() == null) { fmt.format(" METRO"); } else { fmt.format( " %s[%2s] Train #%4s ", railSegment.getOperatingCompany().getName(), railSegment.getOperatingCompany().getCode(), railSegment.getTrainNumber()); } fmt.format( " --- From " + railSegment.getOriginStationName() + " to " + railSegment.getDestinationStationName()); if (railSegment.getTravelTime() != null) { fmt.format("Travel time: %s minutes\n", railSegment.getTravelTime()); } else { fmt.format("\n"); } } fmt.format( " Arrive %Tc\n", Helper.dateFromISO8601(journey.getArrivalTime())); }