taxisrus.publicinterface
Interface SchedulerInterface

All Known Implementing Classes:
Scheduler

public interface SchedulerInterface


Field Summary
static boolean ASK_CABS_ONLY_ONCE
           
static int DEFAULT_AVERAGE_WAIT
           
static long DEFAULT_MIN_ETA
           
 
Method Summary
 Date addCustomerToQueue(Customer to_pickup)
          Add a new customer to queue of customers waiting to be picked up.
 void assignMapper(MapperInterface new_main_mapper)
          Stores a reference to the main mapper.
 void assignModel(ModelInterface new_main_model)
          Stores a reference to the main model.
 void assignNewAverageWait(int new_average_wait)
          Store a new average_wait.
 void assignNewMinETA(int new_min_ETA)
          Store a new min_ETA.
 boolean cancelCustomer(Customer to_cancel)
          Cancel given Customer's ride request.
 Customer changeCustomerCopy(Customer currCust, Customer newCust)
          Finds currCust within the scheduler, and replaces it with newCust.
 boolean customerPickup(int cab_id)
          Function to remove customers from the Scheduler's queue when they are picked up.
 Customer findCustomer(Customer to_find)
          Check if a customer is in a queue.
 int getAverageWait()
          Get current value of average_wait.
 int getMinETA()
          Get current value of min_ETA, in minutes.
 

Field Detail

ASK_CABS_ONLY_ONCE

public static final boolean ASK_CABS_ONLY_ONCE

DEFAULT_AVERAGE_WAIT

public static final int DEFAULT_AVERAGE_WAIT

DEFAULT_MIN_ETA

public static final long DEFAULT_MIN_ETA
Method Detail

getAverageWait

public int getAverageWait()
Get current value of average_wait. This is the average wait a customer experiences while being scheduled.
Returns:
int average_wait, in minutes

getMinETA

public int getMinETA()
Get current value of min_ETA, in minutes. min_ETA is the minimum amount of time it could take for a cab to reach a customer. This could be called the 'cross-zone' time, since it refers to the maximum amount of time a cab will take to get accross a zone.
Returns:
int min_ETA, in minutes

assignModel

public void assignModel(ModelInterface new_main_model)
                 throws BadParamException
Stores a reference to the main model. Throws BadParamException if the parameter is null
Parameters:
Model - main_model
Throws:
BadParamException -  

assignMapper

public void assignMapper(MapperInterface new_main_mapper)
                  throws BadParamException
Stores a reference to the main mapper. Throws BadParamException if the parameter is null
Parameters:
Mapper - main_mapper
Throws:
BadParamException -  

assignNewAverageWait

public void assignNewAverageWait(int new_average_wait)
                          throws BadParamException
Store a new average_wait. Throws BadParamException if new_average_wait < 0.
Parameters:
int - new_average_wait, in minutes
Throws:
BadParamException -  

assignNewMinETA

public void assignNewMinETA(int new_min_ETA)
                     throws BadParamException
Store a new min_ETA. min_ETA is the minimum amount of time it could take for a cab to reach a customer. This could be called the 'cross-zone' time, since it refers to the maximum amount of time a cab will take to get accross a zone. Throws BadParamException if new_min_ETA < 0.
Parameters:
int - new_min_ETA, in minutes
Throws:
BadParamException - if new_min_ETA < 0

addCustomerToQueue

public Date addCustomerToQueue(Customer to_pickup)
Add a new customer to queue of customers waiting to be picked up. Returns an estimated pickup time based on number of customers waiting in zone if no cabs are available. If a cab is available, will return an ETA that is based on the user-defined min_ETA.
Parameters:
Customer - to_queue - Customer to add to list
Returns:
Date - Estimated pickup time

findCustomer

public Customer findCustomer(Customer to_find)
Check if a customer is in a queue. Return a reference to the customer if found. Lookup by FirstName, LastName, and PhoneNumber.
Parameters:
Customer - - Customer to find.
Returns:
Customer - Reference to the customer found. This will have the customer's status. Will be null if not found.

cancelCustomer

public boolean cancelCustomer(Customer to_cancel)
Cancel given Customer's ride request. Return if customer is successfully found. Will communicate with cab console if neccesary.
Parameters:
Customer - - Customer to cancel
Returns:
boolean - True if customer was successfully found & cancelled

customerPickup

public boolean customerPickup(int cab_id)
Function to remove customers from the Scheduler's queue when they are picked up. Should be called by the Model when the CabConsole signals a customer pickup.
Parameters:
cab_id - - ID of the Cab that just picked up the customer
Returns:
boolean - True if customer was successfully removed.

changeCustomerCopy

public Customer changeCustomerCopy(Customer currCust,
                                   Customer newCust)
Finds currCust within the scheduler, and replaces it with newCust. Assumes that all fields are non-critical to customer pickup, and that the customer does not need to be rescheduled.
Parameters:
Customer - currCust - Old customer as stored in Scheduler
Customer - newCust - New customer to replace currCust in Scheduler


API documentation for build 958