예제 #1
0
  // deletes the entire item
  protected boolean deleteItem(int id, String key) {
    Trace.info("RM::deleteItem(" + id + ", " + key + ") called");
    ReservableItem curObj = (ReservableItem) readData(id, key);
    Flight tempItem =
        new Flight(Integer.parseInt(curObj.getLocation()), curObj.getCount(), curObj.getPrice());
    tempItem.setReserved(curObj.getReserved());
    // Check if there is such an item in the storage
    if (curObj == null) {
      Trace.warn("RM::deleteItem(" + id + ", " + key + ") failed--item doesn't exist");
      return false;
    } else {
      if (curObj.getReserved() == 0) {

        tempItem.setType(0);
        writeDataToLog(id, curObj.getKey(), tempItem);
        removeData(id, curObj.getKey());
        Trace.info("RM::deleteItem(" + id + ", " + key + ") item deleted");
        return true;
      } else {
        Trace.info(
            "RM::deleteItem("
                + id
                + ", "
                + key
                + ") item can't be deleted because some customers reserved it");
        return false;
      }
    } // if
  }
예제 #2
0
    private void next() {
      if (currentTask != -1) Bukkit.getScheduler().cancelTask(currentTask);

      if (onTask != null) inFlight.add(onTask);

      onTask = inFlight.poll();
      if (onTask == null) return;

      if (onTask.timeToEnd() <= 0) {
        onTask.cancel();
        currentTask = -1;
        onTask = null;
        next();
        return;
      }

      currentTask =
          Bukkit.getScheduler()
              .scheduleSyncDelayedTask(
                  Bastion.getPlugin(),
                  new BukkitRunnable() {

                    @Override
                    public void run() {
                      onTask.cancel();
                      onTask = null;
                      currentTask = -1;
                      next();
                    }
                  },
                  onTask.timeToEnd());
    }
 /**
  * Calculates the total cost from all flights in this itinerary.
  *
  * @return the total of all the costs in an itinerary.
  */
 public double getCreatedItineraryCost() {
   double returnCost = 0.00;
   for (Flight currFlight : this.flights) {
     returnCost += currFlight.getCost();
   }
   return returnCost;
 }
예제 #4
0
  /** Calculates the wait time between all the flights and adds it to the total travel time. */
  public void calculateWaitTime() {
    if (this.flights.size() >= 2) {
      int i = 0;
      int j = 1;
      Flight f1 = this.flights.get(i);
      Flight f2 = this.flights.get(j);
      Integer waitTime;
      boolean done = false;

      do {
        Calendar f1Arrive = f1.getArrivalDateTime();
        Calendar f2Depart = f2.getDepartureDateTime();

        // subtract departure and arrival time
        waitTime = (int) ((f2Depart.getTimeInMillis() - f1Arrive.getTimeInMillis()) / (1000 * 60));
        // Add waittime to total travel time.
        this.waitTimes.add(waitTime);
        this.totalTravelTime += waitTime;

        // end when we've calculate all waittimes
        if (j == this.flights.size() - 1) {
          done = true;
        } else {
          i++;
          j++;
          f1 = this.flights.get(i);
          f2 = this.flights.get(j);
        }
      } while (!done);
    }
  }
예제 #5
0
  /**
   * Constructs a new itinerary object with origin and destination based on flights within it.
   *
   * @param flights The list of the itineray's flights
   */
  public Itinerary(ArrayList<Flight> flights) {
    try {
      // Create new calander for departure date time for easy calculation
      // of time between arrival and departure dates.
      GregorianCalendar temp = flights.get(0).getDepartureDateTime();
      this.departureDate =
          new GregorianCalendar(
              temp.get(Calendar.YEAR), temp.get(Calendar.MONTH), temp.get(Calendar.DATE));
      this.origin = flights.get(0).getOrigin();
      this.destination = flights.get(flights.size() - 1).getDestination();
      this.flights = flights;
      this.departureDateAsStr = flights.get(0).getDepartureDateTimeAsStr().split(" ")[0];

      // cycle through all flights and get total cots and total
      // travel time without wait time
      for (Flight f : this.flights) {
        this.totalCost += f.getCost();
        this.totalTravelTime += f.calculateTravelTime();
      }

      // Calculate wait time between flights as a list of int in minutes.
      this.calculateWaitTime();
    } catch (IndexOutOfBoundsException e) {
      System.out.println("Empty list of flights given " + e.getMessage());
    }
  }
예제 #6
0
  public int CalculateHandlingTime() {
    int minutes = 0;
    Gate arrivalGate = arrival.getLanding();
    Gate departureGate = destination.getTakeoff();

    if (arrivalGate.equals(departureGate)) {
      return 20; // assuming they have to unload all baggage and reload the baggage that doesnt
                 // transfer to
      // different planes
    }

    int ag = arrivalGate.getGateNumber(); // to extract the numbers from the gate string
    int dg = departureGate.getGateNumber();

    if (arrivalGate.getGateTerminal().equals(departureGate.getGateTerminal())) // if same terminal
    {
      if (ag < dg) {
        minutes = 20 + dg - ag;
      } else {
        minutes = 20 + ag - dg;
      }
    } else // not same terminal
    {
      minutes = 20 + ag + dg;
    }

    return minutes;
  }
 /**
  * Returns True if this itinerary is bookable.
  *
  * @return True if number of seats > 0 on all its flights.
  */
 public boolean ifBookable() {
   for (Flight currFlight : this.flights) {
     if (currFlight.getNumSeats() == 0) {
       return false;
     }
   }
   return true;
 }
  /**
   * Returns all of the costs from each flight in an itinerary.
   *
   * @param flights is an array list of flights that a user has selected.
   * @return an array list of the total costs from each flight.
   */
  public ArrayList<Double> getCosts(ArrayList<Flight> flights) {
    ArrayList<Double> costs = new ArrayList<Double>();

    for (Flight flight : flights) {
      costs.add(flight.getCost());
    }

    return costs;
  }
예제 #9
0
 /**
  * Returns the flights that leave on date from origin and travel to destination.
  *
  * @param date the date of departure
  * @param origin the place of departure
  * @param destination the place of arrival
  * @return String of flights that leave on date from origin and travel to destination
  */
 public static String getFlights(String date, String origin, String destination) {
   String res = "";
   ArrayList<Flight> flights = Client.getFlights(date, origin, destination);
   for (Flight flight : flights) {
     res += flight.toString() + "\n";
   }
   res = res.trim();
   return res;
 }
예제 #10
0
  @Test
  public void retrieveFullFlightInformation() {

    TddAirApplication app = new TddAirApplication();

    Flight flight = app.getFlight("AA242");
    String result = flight.getFullFlightInfo();
    assertTrue("| AA242 | DFW-ORD | 924 |".equals(result));
  }
예제 #11
0
  // Deletes customer from the database.
  public boolean deleteCustomer(int id, int customerID) throws RemoteException {
    Trace.info("RM::deleteCustomer(" + id + ", " + customerID + ") called");
    Customer cust = (Customer) readData(id, Customer.getKey(customerID));

    if (cust == null) {
      Trace.warn(
          "RM::deleteCustomer(" + id + ", " + customerID + ") failed--customer doesn't exist");
      return false;
    } else {
      Customer temp = cust.clone();
      // Increase the reserved numbers of all reservable items which the customer reserved.
      RMHashtable reservationHT = cust.getReservations();
      for (Enumeration e = reservationHT.keys(); e.hasMoreElements(); ) {
        String reservedkey = (String) (e.nextElement());
        ReservedItem reserveditem = cust.getReservedItem(reservedkey);
        Trace.info(
            "RM::deleteCustomer("
                + id
                + ", "
                + customerID
                + ") has reserved "
                + reserveditem.getKey()
                + " "
                + reserveditem.getCount()
                + " times");
        ReservableItem item = (ReservableItem) readData(id, reserveditem.getKey());
        Trace.info(
            "RM::deleteCustomer("
                + id
                + ", "
                + customerID
                + ") has reserved "
                + reserveditem.getKey()
                + "which is reserved"
                + item.getReserved()
                + " times and is still available "
                + item.getCount()
                + " times");
        Flight tempItem =
            new Flight(Integer.parseInt(item.getLocation()), item.getCount(), item.getPrice());
        tempItem.setReserved(item.getReserved());
        tempItem.setType(0);
        item.setReserved(item.getReserved() - reserveditem.getCount());
        item.setCount(item.getCount() + reserveditem.getCount());
        if (readDataFromLog(id, item.getKey(), id) == null)
          writeDataToLog(id, item.getKey(), tempItem);
      }

      // remove the customer from the storage
      temp.setType(1);
      if (readDataFromLog(id, cust.getKey(), id) == null) writeDataToLog(id, cust.getKey(), temp);
      removeData(id, cust.getKey());

      Trace.info("RM::deleteCustomer(" + id + ", " + customerID + ") succeeded");
      return true;
    } // if
  }
 public boolean createSection(String flightID, int row, int col, SeatClass seatClass, String id) {
   boolean createSection = false;
   Flight flight = flights.get(flightID);
   if (flight == null) System.out.println("Impossible de creer la section, Vol inexistant");
   else
     for (Flight fl : flights.values()) {
       createSection = flight.createSection(row, col, seatClass, id);
     }
   return createSection;
 }
  private static void getNewBooking() {
    Itinerary i = null;

    while (i == null) {
      System.out.print("Departure city: ");
      String depCity = input.next();

      System.out.print("Destination city: ");
      String destCity = input.next();

      i = service.getItinerary(depCity, destCity);

      if (i != null) {
        System.out.println("A possible itinerary is:");
        for (Flight flight : i.flights) {
          System.out.println(
              "    Dep: " + flight.getDepartureCity() + "    Dest: " + flight.getDestinationCity());
        }
      } else {
        System.out.println("No routes for these cities. Please try another.");
      }
    }

    String price = "";
    String date = null;

    while (price.equals("")) {
      System.out.print("Select a date (aaaa-mm-dd): ");
      date = input.next();

      price = service.checkAvailable(i.getId(), date);

      if (price.equals("")) {
        System.out.println("No flights available in that date. Please try another.");
      } else {
        System.out.println("The price for this flight is " + price);
      }
    }

    System.out.print(
        "If you want to proceed with the booking, please insert the credit card. "
            + "Otherwise insert 0: ");
    String creditCard = input.next();

    if (!creditCard.equals("0")) {
      BookedFlight booking = new BookedFlight();
      booking.setDate(date);
      booking.setItineraryId(i.getId());

      booking = service.postBooking(booking, creditCard);

      System.out.println("Your booking id is " + booking.getBookingId() + ".");
      System.out.println("Your flight was booked with success!");
    }
  }
 public FlightDelayEvent convertToDelayEvent(String flightNumberAndDelay) {
   String[] splits = flightNumberAndDelay.split("[+]");
   Flight flight = this.flightScheduler.nextFlightForNumber(splits[0]);
   int hours = Integer.parseInt(splits[1].substring(0, 2));
   int minutes = Integer.parseInt(splits[1].substring(2));
   Calendar cal = Calendar.getInstance();
   cal.setTime(flight.getScheduledDeparture());
   cal.add(Calendar.HOUR, hours);
   cal.add(Calendar.MINUTE, minutes);
   return new FlightDelayEvent(flight, cal.getTime());
 }
 public HashMap<String, Flight> getAvailableFlights(Airport org, Airport dest) {
   HashMap<String, Flight> flightsAvailable = new HashMap<>();
   for (Flight flight : flights.values()) {
     if (flight.getOrig() == org && flight.getDest() == dest) {
       for (FlightSection flightSection : flight.getFlightSection()) {
         if (flightSection.hasAvailableSeats()) {
           flightsAvailable.put("", flight);
         }
       }
     }
   }
   return flightsAvailable;
 }
예제 #16
0
 /**
  * Returns a String representation of this Itinerary.
  *
  * @return This Itinerary as a String.
  */
 @Override
 public String toString() {
   String str = new String();
   for (Flight f : this.flights) {
     str += f.toString().substring(0, f.toString().lastIndexOf(",")) + "\n";
   }
   // Make sure decimal is to 2 decimal place.
   DecimalFormat df = new DecimalFormat(".00");
   str += df.format(this.getTotalCost()) + "\n";
   str +=
       String.format("%02d", this.getTotalTraveTime() / 60)
           + ":"
           + String.format("%02d", this.getTotalTraveTime() % 60);
   return str;
 }
  /**
   * Calculates the total travel time from all flights in this itinerary.
   *
   * @return the total travel time of all Flights in an itinerary.
   */
  public int getCreatedItineraryTime() {
    int returnTime = 0;
    long StopOver;
    int i = 1;

    for (Flight currFlight : flights) {
      returnTime += currFlight.getTravelTime();
      if (i < flights.size()) {
        StopOver = currFlight.getStopOverTime(flights.get(i));
        returnTime += StopOver;
      }
      i++;
    }
    return returnTime;
  }
예제 #18
0
 // Create a new flight, or add seats to existing flight.
 // Note: if flightPrice <= 0 and the flight already exists, it maintains
 // its current price.
 @Override
 public boolean addFlight(int id, int flightNumber, int numSeats, int flightPrice) {
   Trace.info(
       "RM::addFlight("
           + id
           + ", "
           + flightNumber
           + ", $"
           + flightPrice
           + ", "
           + numSeats
           + ") called.");
   Flight curObj = (Flight) readData(id, Flight.getKey(flightNumber));
   synchronized (syncLock) {
     if (curObj == null) {
       // Doesn't exist; add it.
       Flight newObj = new Flight(flightNumber, numSeats, flightPrice);
       writeData(id, newObj.getKey(), newObj);
       Trace.info(
           "RM::addFlight("
               + id
               + ", "
               + flightNumber
               + ", $"
               + flightPrice
               + ", "
               + numSeats
               + ") OK.");
     } else {
       // Add seats to existing flight and update the price.
       curObj.setCount(curObj.getCount() + numSeats);
       if (flightPrice > 0) {
         curObj.setPrice(flightPrice);
       }
       writeData(id, curObj.getKey(), curObj);
       Trace.info(
           "RM::addFlight("
               + id
               + ", "
               + flightNumber
               + ", $"
               + flightPrice
               + ", "
               + numSeats
               + ") OK: "
               + "seats = "
               + curObj.getCount()
               + ", price = $"
               + flightPrice);
     }
     return (true);
   }
 }
예제 #19
0
 public ReturnTuple<Boolean> deleteFlight(int id, int flightNum, Timestamp timestamp)
     throws RemoteException, TransactionAbortedException, InvalidTransactionException {
   if (!isMaster) {
     System.out.println("Slave retransmitting deleteFlight to master");
     return this.getMaster().deleteFlight(id, flightNum, timestamp);
   } else {
     timestamp.stamp();
     DeleteFlightRMICommand df = new DeleteFlightRMICommand(flightGroup, id, flightNum);
     df.setTimestampObject(timestamp);
     ReturnTuple<Boolean> result = null;
     try {
       overseer.validTransaction(id);
       lm.Lock(id, Flight.getKey(flightNum), df.getRequiredLock());
       df.execute();
       result = df.success;
       if (result.result) overseer.addCommandToTransaction(id, df);
     } catch (DeadlockException d) {
       timestamp.stamp();
       overseer.abort(id);
       timestamp.stamp();
       throw new TransactionAbortedException(timestamp);
     } catch (TransactionAbortedException tae) {
       tae.t = timestamp;
       throw tae;
     } catch (InvalidTransactionException ite) {
       ite.t = timestamp;
       throw ite;
     }
     result.timestamp.stamp();
     return result;
   }
 }
 @Override
 public boolean equals(Object obj) {
   if (this == obj) return true;
   if (obj == null) return false;
   if (getClass() != obj.getClass()) return false;
   Itinerary other = (Itinerary) obj;
   boolean equal = false;
   for (Flight f : this.flights) {
     for (Flight o : other.flights) {
       if (f.equals(o)) {
         equal = true;
       }
     }
   }
   return equal;
 }
예제 #21
0
 // Returns price of this flight
 public ReturnTuple<Integer> queryFlightPrice(int id, int flightNum, Timestamp timestamp)
     throws RemoteException, TransactionAbortedException, InvalidTransactionException {
   if (!isMaster) {
     System.out.println("Slave retransmitting queryFlightPrice to master");
     return this.getMaster().queryFlightPrice(id, flightNum, timestamp);
   } else {
     timestamp.stamp();
     QueryFlightPriceRMICommand qfp = new QueryFlightPriceRMICommand(flightGroup, id, flightNum);
     qfp.setTimestampObject(timestamp);
     ReturnTuple<Integer> result = null;
     try {
       overseer.validTransaction(id);
       lm.Lock(id, Flight.getKey(flightNum), qfp.getRequiredLock());
       qfp.execute();
       result = qfp.price;
     } catch (DeadlockException d) {
       timestamp.stamp();
       overseer.abort(id);
       timestamp.stamp();
       throw new TransactionAbortedException(timestamp);
     } catch (TransactionAbortedException tae) {
       tae.t = timestamp;
       throw tae;
     } catch (InvalidTransactionException ite) {
       ite.t = timestamp;
       throw ite;
     }
     result.timestamp.stamp();
     return result;
   }
 }
  /**
   * returns a string representation of the Itinerary.
   *
   * @return string representation of the Itinerary.
   */
  @Override
  public String toString() {
    String returnString = "";
    int time = this.getCreatedItineraryTime();
    double cost = this.getCreatedItineraryCost();
    int hours = time / 60;
    int minutes = time % 60;

    for (Flight flight : this.flights) {
      returnString +=
          flight.getFlightNum()
              + ","
              + flight.getDepartureDateTime()
              + ","
              + flight.getArrivalDateTime()
              + ","
              + flight.getAirline()
              + ","
              + flight.getOrigin()
              + ","
              + flight.getDestination()
              + "\n";
    }
    returnString +=
        String.format("%.2f", cost)
            + "\n"
            + String.format("%02d", hours)
            + ":"
            + String.format("%02d", minutes);
    return returnString;
  }
 public Flight createFlight(Airport orig, Airport dest, Calendar calendar, String id) {
   boolean isValidFlight = Flight.testIdLenght(id);
   if (isValidFlight) {
     Flight flight = new Flight(orig, dest, calendar, id);
     flights.put(id, flight);
     return flight;
   }
   return null;
 }
예제 #24
0
 /** Test of insert method, of class Flight. */
 @Test
 public void testInsert() throws Exception {
   f1.insert(db);
   ResultSet rs = db.execute("SELECT * FROM Flights ORDER BY id ASC");
   rs.last();
   assertEquals(rs.getString("startdestination"), "Copenhagen");
   assertEquals(rs.getString("enddestination"), "London");
   assertEquals(rs.getInt("numberofseats"), 100);
   assertEquals(rs.getString("timestamp"), "14:00");
 }
예제 #25
0
 void manage(Flight flight) {
   inFlight.add(flight);
   if (onTask == null) {
     next();
     return;
   }
   if (onTask.compareTo(flight) == 1 || onTask == null) {
     this.next();
   }
 }
예제 #26
0
파일: Order.java 프로젝트: kadric/dreamteam
 @Override
 public String toString() {
   return "Order{ "
       + "id="
       + getId()
       + ", flight= "
       + flight.toString()
       + ", user ="******"}";
 }
예제 #27
0
  public void abort(int transactionId) throws RemoteException, InvalidTransactionException {
    int indx = logContains(transactionId);

    Log temp;

    if (indx > -1) {

      temp = (Log) logArray.elementAt(indx);

    } else {
      System.out.println("nothing in array");
      return;
    }

    for (Enumeration e = temp.getKeys(); e.hasMoreElements(); ) {
      System.out.println("For loop");
      String key = (String) (e.nextElement());
      RMItem obj = temp.get(key);
      if (obj.getType() == 0) {
        Flight flight = (Flight) obj;
        if (flight.getCount() == -1) {
          System.out.println("entering count=-1 block");
          removeData(transactionId, key);
        } else {
          System.out.println("entering other block");
          writeData(transactionId, key, flight);
        }
      } else if (obj.getType() == 1) {
        Customer cust = (Customer) obj;
        if (cust.getID() == -1) {
          System.out.println("entering remove data for customer");
          removeData(transactionId, key);
        } else {
          System.out.println("entering write data for customer");
          writeData(transactionId, key, obj);
        }
      }
    }
  }
예제 #28
0
  /**
   * Look through the (hard-coded) list of flights and return the number of flights from the home
   * airport to the destination. If direct is true, then only consider direct flights; if it is
   * false, count flights that consist of two segments, too. However, in those cases, only report
   * flights in which the total time is less than or equal to the specified timeLimit.
   */
  public int numFlights(String home, String dest, boolean direct, int timeLimit) {
    // keep track of the number of flights
    int count = 0;
    // clear the ArrayLists
    _directFlights.clear();
    _indirectFlights.clear();

    // the array of all flights
    Flight[] allFlights = Flight.allFlights();

    // first, find direct flights
    for (int i = 0; i < allFlights.length; i++) {
      Flight f = allFlights[i];
      if (f.start().equals(home) && f.end().equals(dest)) {
        _directFlights.add(f);
        count++;
      }
    }

    // then, find indirect flights (max two segments)
    if (!direct) {
      for (int i = 0; i < allFlights.length; i++) {
        if (allFlights[i].start().equals(home)) {
          for (int j = 0; j < allFlights.length; j++) {
            if ((i != j)
                && allFlights[i].end().equals(allFlights[j].start())
                && allFlights[j].end().equals(dest)
                && allFlights[i].time() + allFlights[j].time() <= timeLimit) {
              Flight indirectFlight[] = {allFlights[i], allFlights[j]};
              _indirectFlights.add(indirectFlight);
              count++;
            }
          }
        }
      }
    }

    return count;
  }
예제 #29
0
 /* reserve an itinerary */
 public ReturnTuple<Boolean> itinerary(
     int id,
     int customer,
     Vector flightNumbers,
     String location,
     boolean Car,
     boolean Room,
     Timestamp timestamp)
     throws RemoteException, TransactionAbortedException, InvalidTransactionException {
   if (!isMaster) {
     System.out.println("Slave retransmitting itinerary to master");
     return this.getMaster()
         .itinerary(id, customer, flightNumbers, location, Car, Room, timestamp);
   } else {
     timestamp.stamp();
     ItineraryRMICommand i =
         new ItineraryRMICommand(
             carGroup, flightGroup, roomGroup, id, customer, flightNumbers, location, Car, Room);
     i.setTimestampObject(timestamp);
     ReturnTuple<Boolean> result = null;
     try {
       overseer.validTransaction(id);
       lm.Lock(id, Customer.getKey(customer), i.getRequiredLock());
       lm.Lock(id, ResImpl.Car.getKey(location), i.getRequiredLock());
       lm.Lock(id, Hotel.getKey(location), i.getRequiredLock());
       for (Object flightNo : flightNumbers) {
         int flightNum = Integer.parseInt((String) flightNo);
         lm.Lock(id, Flight.getKey(flightNum), i.getRequiredLock());
       }
       i.execute();
       result = i.success;
       if (result.result && !i.error()) overseer.addCommandToTransaction(id, i);
     } catch (DeadlockException d) {
       timestamp.stamp();
       overseer.abort(id);
       timestamp.stamp();
       throw new TransactionAbortedException(timestamp);
     } catch (TransactionAbortedException tae) {
       tae.t = timestamp;
       throw tae;
     } catch (InvalidTransactionException ite) {
       ite.t = timestamp;
       throw ite;
     }
     result.timestamp.stamp();
     return result;
   }
 }
예제 #30
0
 // return a bill
 public ReturnTuple<String> queryCustomerInfo(int id, int customerID, Timestamp timestamp)
     throws RemoteException, TransactionAbortedException, InvalidTransactionException {
   if (!isMaster) {
     System.out.println("Slave retransmitting queryCustomerInfo to master");
     return this.getMaster().queryCustomerInfo(id, customerID, timestamp);
   } else {
     timestamp.stamp();
     QueryCustomerInfoRMICommand qci =
         new QueryCustomerInfoRMICommand(carGroup, flightGroup, roomGroup, id, customerID);
     qci.setTimestampObject(timestamp);
     ReturnTuple<String> result = null;
     try {
       Vector<Integer> flightNos;
       Vector<String> locations;
       overseer.validTransaction(id);
       lm.Lock(id, Customer.getKey(customerID), qci.getRequiredLock());
       qci.execute();
       flightNos = qci.getCustomerFlightReservations();
       for (int flightNo : flightNos) {
         lm.Lock(id, Flight.getKey(flightNo), qci.getRequiredLock());
       }
       locations = qci.getCustomerRoomReservations();
       for (String location : locations) {
         lm.Lock(id, Hotel.getKey(location), qci.getRequiredLock());
       }
       locations = qci.getCustomerCarReservations();
       for (String location : locations) {
         lm.Lock(id, Car.getKey(location), qci.getRequiredLock());
       }
       qci.execute();
       result = qci.customerInfo;
     } catch (DeadlockException d) {
       timestamp.stamp();
       overseer.abort(id);
       timestamp.stamp();
       throw new TransactionAbortedException(timestamp);
     } catch (TransactionAbortedException tae) {
       tae.t = timestamp;
       throw tae;
     } catch (InvalidTransactionException ite) {
       ite.t = timestamp;
       throw ite;
     }
     result.timestamp.stamp();
     return result;
   }
 }