taxisrus.publicinterface
Interface ModelRMIInterface

All Superinterfaces:
Remote
All Known Implementing Classes:
ModelRMI

public interface ModelRMIInterface
extends Remote

ModelRMIInterface Public Interface to define RMI THIS INTERFACE IS FOR THE DISPATHCHER UI - PLEASE TELL US WHAT METHODS YOU NEED!!! PLEASE EMAIL INTERFACE CHANGE REQUESTS TO MIKAM TRIBE: margaux, ianli, kkchen, alexcho, meilye

Author:
mikam tribe

Method Summary
 Object 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
 Object cancelCustomer(String customerPhone, String customerLastName, String customerFirstName)
          Cancel the customer, returns true for successful cancellation
 Object changeCustomer(Customer oldCustomer, Customer newCustomer)
          Changes customer in the system For Dispatcher UI
 Object 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 getReport(int typeOfReport, int specificity, int timeInterval)
          For ManagerUI: Given an enumerated type of report, this method will return a Report designed for a manager of the cab company
 ManagerReport getReport(int typeOfReport, int specificity, int timeInterval, Date from, Date to)
          Passes ManagerReport request from ManagerUI to DataStore Given an enumerated type of report, this method will return a Report designed for a manager of the cab company
 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 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
 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
 

Method Detail

addCustomer

public Object addCustomer(Customer customer)
                   throws RemoteException
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
Parameters:
customer - customer object to be added
Returns:
ETA the estimated pickup time

cancelCustomer

public Object cancelCustomer(String customerPhone,
                             String customerLastName,
                             String customerFirstName)
                      throws RemoteException
Cancel the customer, returns true for successful cancellation
Parameters:
customer_id -  
customerLastName -  
Returns:
Boolean object (NOT PRIMITIVE!)

getCustomer

public Object getCustomer(String customerPhone,
                          String customerLastName,
                          String customerFirstName)
                   throws RemoteException
Returns the Customer identified by the phone number and last name
PRECONDITION: scheduler contains the target customer
POSTCONDITION: none
Parameters:
customerPhone -  
customerLastName -  
Returns:
customer that matches the phone and name

changeCustomer

public Object changeCustomer(Customer oldCustomer,
                             Customer newCustomer)
                      throws RemoteException
Changes customer in the system For Dispatcher UI
Parameters:
old - customer - copy
new - customer
Returns:
ETA (Date object) of changed customer, if null, customer was not found anymore or customer did not/could not be changed

updateModelCabInfo

public boolean updateModelCabInfo(String cust_info)
                           throws RemoteException
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
Parameters:
must - be in this format:
"cab_id \n status \n gps \n meter \n mileage \n pickuptime", or
"cab_id \n status \n date"
where status = 0 dropped off customer, 1 accepted fare, 2 picked up customer
where date = Date.toString()
assumes: cab_id is int,
gps is "(,)",
meter is double, status is true or false,
ride mileage is float

registerCabToModel

public Boolean registerCabToModel(CabConsoleInterface cabConsole,
                                  int cab_id,
                                  int driver_id,
                                  String gps)
                           throws RemoteException
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
Returns:
true (Boolean object) if both id's are valid, false otherwise

isCreditCardAccepted

public boolean isCreditCardAccepted(double chargedAmount,
                                    String creditCardNumber)
                             throws RemoteException
"Approve" credit card
-- passes the charge amount and creditCardNumber to bank and sees if the card is approved
PRECONDITION: none
POSTCONDITION: none
Parameters:
chargedAmount - amount to charge
creditCardNumber - credit card number
Returns:
whether the card was accepted

getReport

public ManagerReport getReport(int typeOfReport,
                               int specificity,
                               int timeInterval)
                        throws RemoteException
For ManagerUI: Given an enumerated type of report, this method will return a Report designed for a manager of the cab company
Parameters:
typeOfReport -  
specificity -  
timeInterval -  
Returns:
ManagerReport

getReport

public ManagerReport getReport(int typeOfReport,
                               int specificity,
                               int timeInterval,
                               Date from,
                               Date to)
                        throws RemoteException
Passes ManagerReport request from ManagerUI to DataStore Given an enumerated type of report, this method will return a Report designed for a manager of the cab company
Parameters:
typeOfReport - - type of report
specificity -  
timeInterval -  
from - - starting date for query
to - - ending date for query
Returns:
the manager report


API documentation for build 958