コード例 #1
0
  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());
  }
コード例 #2
0
 /**
  * Print out some details about a segment. This is far from all the available information.
  *
  * @param segment the segment to be displayed
  * @param fmt the formatter to use to display the data
  */
 public void printLeg(AirSegment segment, Formatter fmt) {
   Date dep = Helper.dateFromISO8601(segment.getDepartureTime());
   fmt.format(
       "AIR Departing from %3s to %3s on %Tc\n",
       segment.getOrigin(), segment.getDestination(), dep);
   fmt.format(
       "         Flight [%2s]#%4s  Flight time: %s minutes\n",
       segment.getCarrier(), segment.getFlightNumber(), segment.getFlightTime());
   fmt.format(
       "                           Arrive %Tc\n",
       Helper.dateFromISO8601(segment.getArrivalTime()));
 }