Example #1
0
 /**
  * Get all the drivers in the database.
  *
  * @return an array of driver objects
  */
 public static Driver[] get_drivers() {
   int[] driver_ids = DriverInfo.getDrivers();
   Driver[] drivers = new Driver[driver_ids.length];
   for (int driver = 0; driver < drivers.length; driver++)
     drivers[driver] = new Driver(DriverInfo.getNumber(driver_ids[driver]));
   return drivers;
 }
Example #2
0
 /**
  * Instantiates an object representing a driver record in the database.
  *
  * @param id the drivers unique identification number
  */
 public Driver(String id) throws InvalidQueryException {
   try {
     name = DriverInfo.getName(DriverInfo.findDriver(id));
     key = DriverInfo.findDriver(id);
     id_number = Integer.parseInt(id);
   } catch (InvalidQueryException e) {
     throw e;
   }
 }
Example #3
0
 /**
  * Determine whether the driver is available on the specified date.
  *
  * @param date the date to check for availability
  * @return Boolean true for available, else false
  */
 public Boolean available(GregorianCalendar date) {
   return DriverInfo.isAvailable(key, date.getTime());
 }
Example #4
0
 /**
  * Returns the number of days of holiday the driver has booked this year, both in the past as well
  * as the future.
  *
  * @return the number of days of holiday used
  */
 public int holiday_used() {
   return DriverInfo.getHolidaysTaken(key);
 }