|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--taxisrus.tests.scheduler_tests.FakeModel
| Constructor Summary | |
FakeModel()
|
|
| Method Summary | |
Date |
addCustomer(Customer customer)
Adds a customer in system. PRECONDITION: Customer must have the following information set already: - call-in time - pickup address - pickup time - destination address POSTCONDITION: customer's information is set scheduler now has customer within domain datastore knows of ride request |
boolean |
cabIsScheduled(Cab cab)
Mark cab as scheduled. |
void |
cabRefusedRide(int cab_id,
int zone_id)
Called when the cab refuses a ride we must update the cab in the model to be placed in the back PRECONDITION: POSTCONDITION: |
void |
cancelCab(int cab_id,
Customer cancelledCustomer)
Cancels scheduled cab, assumes customer field in cab is set scheduler calls when cancelled customer not found in waiting customer queue and msg needs to be relayed to cab console, cab will be placed back into front of zone which cab is found in assume customer's cab field will be set elsewhere (by scheduler) PRECONDITION: customer corresponding to cab has been canceled POSTCONDITION: cab is still in busy cab list, everything but zone is set correctly |
Boolean |
cancelCustomer(String customerPhone,
String customerLastName,
String customerFirstName)
Cancel the customer, returns true for successful cancellation |
Date |
changeCustomer(Customer oldCust,
Customer newCust)
Changes customer in the system For Dispatcher UI |
Vector |
getAllBusyCabs()
Returns the list of busy cabs. PRECONDITION: none POSTCONDITION: none |
Vector |
getArrivingCabs(int zone_id)
Returns all arriving cabs to specified zone; to be used when no cabs available in desired zone. Assumes that the customer field in the cab is set correctly |
Cab |
getBusyCab(int cab_id)
Gets (but does NOT remove) the cab with cab_id from the busy list. -used during actual customer pick-up PRECONDITION: none POSTCONDITION: none |
Vector |
getBusyCabsInZone(int zone_id)
Returns list of busy cabs in specified zone (destination zone of busy cab) PRECONDITION: none POSTCONDITION: none |
Cab |
getCab(int cab_id)
Returns referenced Cab object from zone list--does not remove cab PRECONDITION: cab is waiting in a zone POSTCONDITION: none |
Customer |
getCustomer(String customerPhone,
String customerLastName,
String customerFirstName)
Returns the Customer identified by the phone number and last name PRECONDITION: scheduler contains the target customer POSTCONDITION: none |
ManagerReport |
getManagerReport(int typeOfReport,
int specificity,
int timeInterval)
|
ManagerReport |
getManagerReport(int typeOfReport,
int specificity,
int timeInterval,
Date from,
Date to)
Passes ManagerReport request from ManagerUI to DataStore |
Vector |
getOpenCabs(int zone_id)
Returns all open cabs within specified zone. PRECONDITION: none POSTCONDITION: none |
Zone |
getZone(int zone_id)
Returns specified zone. PRECONDITION: zone_id is a legal zone POSTCONDITION: none |
boolean |
isCreditCardAccepted(double chargedAmount,
String creditCardNumber)
"Approve" credit card -- passes the charge amount and creditCardNumber to bank and sees if the card is approved PRECONDITION: none POSTCONDITION: none |
boolean |
manualDispatchCab(Cab cab,
Customer customer)
Dispatches specified cab to specified customer (NOT YET IMPLEMENTED). |
Boolean |
registerCabToModel(CabConsoleInterface cabConsole,
int cab_id,
int driver_id,
String gps)
registers the cab in the model if cab_id and driver_id are valid (in database) PRECONDITION: both cab and driver identified by cab_id and driver_id registers for the first time. POSTCONDITION: a cab object corresponding to the cab console has been created and placed in its respective zone in the model |
void |
rescheduleCustomer(Customer failedScheduling)
Passes a customer object to a DispatcherUI object for rescheduling. |
boolean |
rideRequest(Customer iWannaRide,
int cab_id)
For Scheduler Relays ride request from scheduler to cab console Responsible only for relaying messages PRECONDITION: valid cab id cab currently in the model POSTCONDITION: none |
boolean |
updateModelCabInfo(String cust_info)
For Cab Console: Called after console updates referenced cab object, this method triggers necessary model updates Case 0: customer dropped off Case 2: customer has been picked up Case 3: customer has canceled and cab has been canceled PRECONDITION: cab console has changed its status and needs to be updated in the model case 0: cab is busy case 2: none case 3: cab has been emptied of its customer and is in the busy cab list POSTCONDITION: case 0: cab is waiting in its appropriate zone case 2: pickup time for customer in database has been updated case 3: cab waiting at front of zone's cab list |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public FakeModel()
| Method Detail |
public Vector getAllBusyCabs()
getAllBusyCabs in interface ModelInterfacepublic Zone getZone(int zone_id)
getZone in interface ModelInterfacezone_id - ID of requested zone
public boolean manualDispatchCab(Cab cab,
Customer customer)
manualDispatchCab in interface ModelInterfacecab - the cab to be dispatchedcustomer - the customer that will be picked uppublic Vector getOpenCabs(int zone_id)
getOpenCabs in interface ModelInterfacezone_id - zone to get cabs from
public boolean rideRequest(Customer iWannaRide,
int cab_id)
rideRequest in interface ModelInterfaceCustomer - who requests ridecab_id - of cab to requestpublic boolean cabIsScheduled(Cab cab)
cabIsScheduled in interface ModelInterfacecab - is the busy cab (reservation)
public void cancelCab(int cab_id,
Customer cancelledCustomer)
cancelCab in interface ModelInterfacecab_id - of cab to cancel
public void cabRefusedRide(int cab_id,
int zone_id)
cabRefusedRide in interface ModelInterfacecab_id - ID of cab that refusedzone_id - ID of zone where cab is locatedpublic void rescheduleCustomer(Customer failedScheduling)
rescheduleCustomer in interface ModelInterfaceCustomer - - Customer who needs to be manually scheduled.public Date addCustomer(Customer customer)
ModelInterfaceaddCustomer in interface ModelInterfacetaxisrus.publicinterface.ModelInterfacecustomer - customer object to be added
public Boolean cancelCustomer(String customerPhone,
String customerLastName,
String customerFirstName)
ModelInterfacecancelCustomer in interface ModelInterfacetaxisrus.publicinterface.ModelInterfacecustomer_id - customerLastName -
public Date changeCustomer(Customer oldCust,
Customer newCust)
ModelInterfacechangeCustomer in interface ModelInterfacetaxisrus.publicinterface.ModelInterfaceold - customer - copynew - customer
public Customer getCustomer(String customerPhone,
String customerLastName,
String customerFirstName)
ModelInterfacegetCustomer in interface ModelInterfacetaxisrus.publicinterface.ModelInterfacecustomerPhone - customerLastName - public Cab getCab(int cab_id)
ModelInterfacegetCab in interface ModelInterfacetaxisrus.publicinterface.ModelInterfacepublic Cab getBusyCab(int cab_id)
ModelInterfacegetBusyCab in interface ModelInterfacetaxisrus.publicinterface.ModelInterfacepublic Vector getBusyCabsInZone(int zone_id)
ModelInterfacegetBusyCabsInZone in interface ModelInterfacetaxisrus.publicinterface.ModelInterfacepublic Vector getArrivingCabs(int zone_id)
ModelInterfacegetArrivingCabs in interface ModelInterfacetaxisrus.publicinterface.ModelInterfacezone_id - the ID of the zone from which to get arriving cabspublic boolean updateModelCabInfo(String cust_info)
ModelInterfaceupdateModelCabInfo in interface ModelInterfacetaxisrus.publicinterface.ModelInterfacemust - be in this format:
public Boolean registerCabToModel(CabConsoleInterface cabConsole,
int cab_id,
int driver_id,
String gps)
ModelInterfaceregisterCabToModel in interface ModelInterfacetaxisrus.publicinterface.ModelInterface
public boolean isCreditCardAccepted(double chargedAmount,
String creditCardNumber)
ModelInterfaceisCreditCardAccepted in interface ModelInterfacetaxisrus.publicinterface.ModelInterfacechargedAmount - amount to chargecreditCardNumber - credit card number
public ManagerReport getManagerReport(int typeOfReport,
int specificity,
int timeInterval)
public ManagerReport getManagerReport(int typeOfReport,
int specificity,
int timeInterval,
Date from,
Date to)
ModelInterfacegetManagerReport in interface ModelInterfacetaxisrus.publicinterface.ModelInterfacetypeOfReport - - type of reportspecificity - timeInterval - from - - starting date for queryto - - ending date for query
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||