taxisrus.publicinterface
Interface DataStoreInterface

All Known Implementing Classes:
DataStoreConnection

public interface DataStoreInterface

DataStoreInterface Public interface to be used with DataStore. PLEASE EMAIL INTERFACE CHANGE REQUESTS TO TEAM DOUG: esp *team-lead*, mirvin, erock

Author:
TEAM DOUG

Method Summary
 boolean addDenial(int cabid, Date date)
          Records a driver rejection of a customer assignment.
 void addMapData(String pictureName, int x1, int y1, int x2, int y2)
          Inserts the data for a map, including the filename and two points representing the bounds of the map.
 boolean addPolygonVertex(int polyid, int vertid, double x, double y)
          Inserts data representing a polygon's vertex, given 2 integers representing the polygon: Zone/polygon ID ( >= 0 ), the vertex identifier ( > 0 ), and 2 doubles representing an x coordinate and a y coordinate.
 boolean addRideRequest(Customer newCustomer)
          Stores a Customer object just after it has been created: it will not have a cab yet so it is a "ride request," but should still have all destination information.
 boolean cancelRideRequest(Customer theCustomer)
          Records the fact that a ride has been canceled by the given customer.
 boolean checkCabID(int driverID, int cabID)
          Given 2 integers relaying values corresponding to a driverid and a cabid that need to be checked for validity (i.e.
 Vector getAllCabs()
          Returns a vector of all of the cab objects stored in the database.
 Vector getAllPolygonVertices(int zoneid)
          Given an integer representing a Zone/polygon identifier, this method returns all the polygon vertex data associated with that polygon in the form of a vector of polygon vertex objects that contain the desired data
 DataStoreConnection.MapData getMapData()
          Returns a mapData object pertaining to the *one* set of MapData held in the db.
 ManagerReport getReport(int typeOfReport, int specificity, int timeInterval, Date from, Date to)
          Returns a Report designed for a manager of the cab company, given an enumerated type of report.
 void removeAllPolygonVertices()
          Removes all polygon vertex data from the database.
 boolean rideHasFinished(Customer theCustomer, Date endTime, double theFare, double milesTraveled)
          Stores the fact that the given customer has reached their destination, and creates and records statistics relevant to the ride.
 boolean storeCabRideAssignment(Cab theCab)
          Moves the temporary customer info in the rideRequest Table into the Customers table and logs the specific ride information into the rideLog table, given a Cab object.
 boolean updateCabRideAssignment(Cab oldCabState, Cab newCabState)
          Updates the ridelog and customer tables, given a cab object representing the previous state of a cab-ride-assignment and a cab object representing the new state of a cab-ride-assignment.
 boolean updateRideRequests(Customer oldCustomerState, Customer newCustomerState)
          Updates the information in the database, given current and previous customer information.
 

Method Detail

addRideRequest

public boolean addRideRequest(Customer newCustomer)
Stores a Customer object just after it has been created: it will not have a cab yet so it is a "ride request," but should still have all destination information.
Parameters:
newCustomer - Customer object without a cab reference
Returns:
boolean value: true if addition was successful, false otherwise.

cancelRideRequest

public boolean cancelRideRequest(Customer theCustomer)
Records the fact that a ride has been canceled by the given customer. These attributes must match a customer in the database: theCustomer._last_name, theCustomer._phone, theCustomer._ETA.
Parameters:
theCustomer - Customer object who corresponds to a previous ride request that is to be canceled
Returns:
boolean indicating whether cancellation was possible: true if the ride request was found and deleted; false otherwise.

updateRideRequests

public boolean updateRideRequests(Customer oldCustomerState,
                                  Customer newCustomerState)
Updates the information in the database, given current and previous customer information. The oldCustomerState must have the old last name, ETA, and phone number. Should be used when the customer changes pickup/destination information, etc.
Parameters:
oldCustomerState - - representing the old customer information
newCustomerState - - representing the new customer information
Returns:
boolean indicating the success of the update

addDenial

public boolean addDenial(int cabid,
                         Date date)
Records a driver rejection of a customer assignment.
Parameters:
cabID - Must be a cabID which is previously existing
date - Date object representing the time of denial

storeCabRideAssignment

public boolean storeCabRideAssignment(Cab theCab)
Moves the temporary customer info in the rideRequest Table into the Customers table and logs the specific ride information into the rideLog table, given a Cab object.
Parameters:
theCab - Cab with Customer reference: the customer just assigned to this cab. Customer CAN NOT have null ETA.
Returns:
boolean indicating success of storage

updateCabRideAssignment

public boolean updateCabRideAssignment(Cab oldCabState,
                                       Cab newCabState)
Updates the ridelog and customer tables, given a cab object representing the previous state of a cab-ride-assignment and a cab object representing the new state of a cab-ride-assignment. This is used to update the information with respect to the customer, that is, the customer should be the same in both cab states (last name is the same). Other customer information can change (and will be updated), and the cabs themselves can be different. Precondition: oldCabState and newCabState contain customers. These customers correspond - that is - their *LAST NAME IS THE SAME*.
Parameters:
oldCabState - old Cab object with customer reference
newCabState - new Cab object with customer reference
Returns:
boolean indicating success of the data manipulation

rideHasFinished

public boolean rideHasFinished(Customer theCustomer,
                               Date endTime,
                               double theFare,
                               double milesTraveled)
Stores the fact that the given customer has reached their destination, and creates and records statistics relevant to the ride. ASSUMPTION: rides that have not finished will have a value of 0.0 for mileage in the rideLog table in the database.
Parameters:
theCustomer - Customer object MUST still have a reference to the cab it rode in. Should have valid actual pickup time.
endTime - Date object representing the time that the ride ended
theFare - double representing the final dollar amount on the meter
milesTraveled - double representing the total number of miles traveled on this ride. Should NOT be 0.0.

getAllCabs

public Vector getAllCabs()
Returns a vector of all of the cab objects stored in the database. Should be used for putting data back into the model on startup/after a crash.
Returns:
Vector containing only Cab objects

addPolygonVertex

public boolean addPolygonVertex(int polyid,
                                int vertid,
                                double x,
                                double y)
Inserts data representing a polygon's vertex, given 2 integers representing the polygon: Zone/polygon ID ( >= 0 ), the vertex identifier ( > 0 ), and 2 doubles representing an x coordinate and a y coordinate.
Parameters:
polyid - >= 0
vertid - > 0
x -  
y -  

getAllPolygonVertices

public Vector getAllPolygonVertices(int zoneid)
Given an integer representing a Zone/polygon identifier, this method returns all the polygon vertex data associated with that polygon in the form of a vector of polygon vertex objects that contain the desired data
Parameters:
zoneid - - must match a currently stored zone
Returns:
Vector of PolygonVertex objects

removeAllPolygonVertices

public void removeAllPolygonVertices()
Removes all polygon vertex data from the database.

addMapData

public void addMapData(String pictureName,
                       int x1,
                       int y1,
                       int x2,
                       int y2)
Inserts the data for a map, including the filename and two points representing the bounds of the map. Note - this method will overwrite any previous data. Only the last set of MapData stored is ever available.
Parameters:
pictureName -  
x1 -  
y1 -  
x2 -  
y2 -  

getMapData

public DataStoreConnection.MapData getMapData()
Returns a mapData object pertaining to the *one* set of MapData held in the db.

getReport

public ManagerReport getReport(int typeOfReport,
                               int specificity,
                               int timeInterval,
                               Date from,
                               Date to)
Returns a Report designed for a manager of the cab company, given an enumerated type of report. If the timeInterval is not FROM_DATE_TO_DATE, any value can go in the from and to inputs. Definition of all enumerated types can be found in the ManagerReportsPanel class.
Parameters:
typeOfReport - enumerated integer representing report type
specificity - enumerated integer representing specificity
timeInterval - enumerated integer representing timeInterval, also found in ManagerReportsPanel.
from - Date that should be before to, if FROM_DATE_TO_DATE is specified.
to -  
Returns:
ManagerReport

checkCabID

public boolean checkCabID(int driverID,
                          int cabID)
Given 2 integers relaying values corresponding to a driverid and a cabid that need to be checked for validity (i.e. that they exist in the db) this method returns the truth of that assumption. Also, sets the current time to the cab's shift start time. Assumption: this function is only called when a cab's shift starts.
Parameters:
driverID - - check for its existance in the db
cabID - - check for its existance in the db
Returns:
whether or not both of these values exist in the db


API documentation for build 958