|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--taxisrus.implementation.Model
| Constructor Summary | |
Model()
Default Model constructor; activates the Mapper UI automatically. |
|
Model(boolean activateMapperUI)
Model constructor PRECONDITION: Mapper has already been fired up POSTCONDITION: _storage, _mapper, _zoneList, _storage initiallized |
|
Model(int testNumZones,
int testPickupZoneID,
int testDestZoneID)
Model constructor for testing. |
|
Model(String dbServerName,
String dbUserName,
String dbUserPassword,
Boolean useNewDB)
Model constructor, takes database info activates the Mapper UI automatically. |
|
| 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 oldCustCopy,
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,
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 |
Scheduler |
getScheduler()
Accessor used in testing |
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 |
Cab |
removeBusyCab(int cab_id)
Removes the cab with cab_id from the busy list. PRECONDITION: target cab is currently busy POSTCONDITION: target cab removed from the busy list |
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 |
CabConsoleImplementation |
unitTest_getCabConsole(int cab_id)
|
boolean |
unitTest_moveCabFromBusyToZone(int cab_id,
int zone_id,
boolean front)
unit test only |
boolean |
unitTest_moveCabFromZoneToBusy(int cab_id,
int zone_id,
int destZoneID)
unit test only |
void |
unitTest_pretendBusyCabs()
Unit test helper method setup an instance in time in which there are busy cabs in the "world." This function will create an instance in which: cab1 has picked up cust1 cab2 has picked up cust2 cust0 and cust3 are waiting PRECONDITIONS: test_setupInitialWorld was just called. |
void |
unitTest_pretendCustomersAreWaitingAndScheduled()
Unit test helper method to setup an instance in time in which there are customers waiting. This function will create an instance in which: cust2 has been scheduled. |
Cab |
unitTest_removeCabFromZone(int cab_id,
int zone_id)
unit test only |
void |
unitTest_setCabConsoleAccepts(boolean cabAccepts)
|
boolean |
updateModelCabInfo(String cab_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 Model()
public Model(String dbServerName,
String dbUserName,
String dbUserPassword,
Boolean useNewDB)
public Model(boolean activateMapperUI)
activateMapperUI - if true then mapperUI is activated;
false, otherwise.
public Model(int testNumZones,
int testPickupZoneID,
int testDestZoneID)
testNumZones - the number of zones to createtestPickupZone - the default ID of pickup zone of customerstestDestZone - the default ID of destination zone of customers| Method Detail |
public Date addCustomer(Customer customer)
addCustomer in interface ModelInterfacecustomer - customer object to be added
public Customer getCustomer(String customerPhone,
String customerLastName,
String customerFirstName)
getCustomer in interface ModelInterfacecustomerPhone - customerLastName - public Cab getCab(int cab_id)
getCab in interface ModelInterfacepublic Vector getBusyCabsInZone(int zone_id)
getBusyCabsInZone in interface ModelInterfacepublic Cab removeBusyCab(int cab_id)
public Cab getBusyCab(int cab_id)
getBusyCab in interface ModelInterfacepublic 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 frompublic Vector getArrivingCabs(int zone_id)
getArrivingCabs in interface ModelInterfacezone_id - the ID of the zone from which to get arriving cabs
public boolean rideRequest(Customer iWannaRide,
int cab_id)
rideRequest in interface ModelInterfaceCustomer - who requests ridecab_id - of cab to request
public void cancelCab(int cab_id,
Customer cancelledCustomer)
cancelCab in interface ModelInterfacecab_id - of cab to cancelpublic boolean cabIsScheduled(Cab cab)
cabIsScheduled in interface ModelInterfacecab - is the busy cab (reservation)
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 located
public Boolean cancelCustomer(String customerPhone,
String customerLastName,
String customerFirstName)
cancelCustomer in interface ModelInterfacecustomer_id - customerLastName -
public Date changeCustomer(Customer oldCustCopy,
Customer newCust)
changeCustomer in interface ModelInterfaceold - customer - copynew - customerpublic boolean updateModelCabInfo(String cab_info)
updateModelCabInfo in interface ModelInterfacemust - be in this format:
public Boolean registerCabToModel(CabConsoleInterface cabConsole,
int cab_id,
int driver_id,
String gps)
registerCabToModel in interface 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,
Date from,
Date to)
getManagerReport in interface ModelInterfacetypeOfReport - - type of reportspecificity - timeInterval - from - - starting date for queryto - - ending date for querypublic void rescheduleCustomer(Customer failedScheduling)
rescheduleCustomer in interface ModelInterfaceCustomer - - Customer who needs to be manually scheduled.public Scheduler getScheduler()
public void unitTest_pretendBusyCabs()
public void unitTest_pretendCustomersAreWaitingAndScheduled()
public CabConsoleImplementation unitTest_getCabConsole(int cab_id)
public void unitTest_setCabConsoleAccepts(boolean cabAccepts)
public boolean unitTest_moveCabFromZoneToBusy(int cab_id,
int zone_id,
int destZoneID)
public boolean unitTest_moveCabFromBusyToZone(int cab_id,
int zone_id,
boolean front)
public Cab unitTest_removeCabFromZone(int cab_id,
int zone_id)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||