taxisrus.implementation.CabConsole
Class CabConsoleImplementation

java.lang.Object
  |
  +--taxisrus.implementation.CabConsole.CabConsoleImplementation
All Implemented Interfaces:
CabConsoleInterface, Remote

public class CabConsoleImplementation
extends Object
implements CabConsoleInterface

Author:
Masters This class implements most of the functionality for the Cab Console but none of the graphic display

Constructor Summary
CabConsoleImplementation(int cabID)
          Creates a CabConsoleImplementation with given CabID
CabConsoleImplementation(ModelRMIInterface model)
          Creates a CabConsoleImplementation with given model
 
Method Summary
 boolean AcceptOrReject(String customerInfo)
          Send ride information from model to Cab Console
 void Cancel(String customerInfo)
          Send a Cancelation message from model to Cab Console.
 void Change(String customerInfo)
          Send a Change message from model to Cab Console.
 void ChangeCabStatus(int cabStatus)
          Change Cab Status
 void ChangeLoginStatus(boolean logginStatus)
          Change Login Status
 void ClearMeter()
          Clear both mileage and amount in meter
 void doneCommunicating()
          Function called when the cabbie makes and Accept/Reject decision
 double GetAmount()
          Get total amount for the shift
 int GetCabStatus()
          Get Cab Status
 boolean GetCreditApproval(String creditCardNum, double chargedAmount)
          Returns if credit approval went through
 double GetMeter()
          Get meter mileage
 String GetOutgoingMessage()
          Get the outgoing message
 void LoginCab(String cabID, String driverID)
          Sets CabID and DriverID after login
static void main(String[] args)
           
protected  String MakeIndividualGPSMsg()
          Create individual GPS String for model registration
 void MakePickedUpMessage()
          Creates a message to be sent to the model after picking up a customer
 void MakeUpdateMessage()
          Creates the outgoing message to be sent to the model
 void SendPickedUpMessage()
          Send message when assigned customer is picked up
 void SendUpdateMessage()
          Send information to the model every time the cab status changes, with GPS,Credit Card, Cab ID, Status, Meter and current time.
 void StartMeter()
          Start meter
 void StopMeter()
          Stop meter
 void timedOut()
          Function called when CabTimerThread fires.
 void UpdateGUI()
          Update the display of the cab console GUI
 boolean VerifyInput(String cabID, String driverID)
          Verify input for Cab Id and Driver ID after login
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CabConsoleImplementation

public CabConsoleImplementation(int cabID)
Creates a CabConsoleImplementation with given CabID
Parameters:
int - cabID

CabConsoleImplementation

public CabConsoleImplementation(ModelRMIInterface model)
Creates a CabConsoleImplementation with given model
Parameters:
ModelRMIInterface - model
Method Detail

LoginCab

public void LoginCab(String cabID,
                     String driverID)
Sets CabID and DriverID after login
Parameters:
String - CabID
String - DriverID

GetOutgoingMessage

public String GetOutgoingMessage()
Get the outgoing message
Returns:
String outgoing message

GetCabStatus

public int GetCabStatus()
Get Cab Status
Returns:
int cab status

ChangeCabStatus

public void ChangeCabStatus(int cabStatus)
Change Cab Status
Parameters:
int - cab status

ChangeLoginStatus

public void ChangeLoginStatus(boolean logginStatus)
Change Login Status
Parameters:
boolean - logged in or not

StartMeter

public void StartMeter()
Start meter

StopMeter

public void StopMeter()
Stop meter

ClearMeter

public void ClearMeter()
Clear both mileage and amount in meter

GetMeter

public double GetMeter()
Get meter mileage
Returns:
double meter mileage

GetAmount

public double GetAmount()
Get total amount for the shift
Returns:
double total amount

GetCreditApproval

public boolean GetCreditApproval(String creditCardNum,
                                 double chargedAmount)
Returns if credit approval went through
Returns:
boolean approved or rejected

UpdateGUI

public void UpdateGUI()
Update the display of the cab console GUI

VerifyInput

public boolean VerifyInput(String cabID,
                           String driverID)
Verify input for Cab Id and Driver ID after login
Returns:
boolean true if conversion was successful

Cancel

public void Cancel(String customerInfo)
            throws RemoteException
Description copied from interface: CabConsoleInterface
Send a Cancelation message from model to Cab Console.
Specified by:
Cancel in interface CabConsoleInterface
See Also:
CabConsoleInterface.Cancel(String)

Change

public void Change(String customerInfo)
            throws RemoteException
Description copied from interface: CabConsoleInterface
Send a Change message from model to Cab Console.
Specified by:
Change in interface CabConsoleInterface
See Also:
CabConsoleInterface.Change(String)

AcceptOrReject

public boolean AcceptOrReject(String customerInfo)
                       throws RemoteException
Description copied from interface: CabConsoleInterface
Send ride information from model to Cab Console
Specified by:
AcceptOrReject in interface CabConsoleInterface
See Also:
CabConsoleInterface.AcceptOrReject(String)

SendPickedUpMessage

public void SendPickedUpMessage()
Send message when assigned customer is picked up

SendUpdateMessage

public void SendUpdateMessage()
Send information to the model every time the cab status changes, with GPS,Credit Card, Cab ID, Status, Meter and current time.

MakeUpdateMessage

public void MakeUpdateMessage()
Creates the outgoing message to be sent to the model

MakePickedUpMessage

public void MakePickedUpMessage()
Creates a message to be sent to the model after picking up a customer

MakeIndividualGPSMsg

protected String MakeIndividualGPSMsg()
Create individual GPS String for model registration

main

public static void main(String[] args)

timedOut

public void timedOut()
Function called when CabTimerThread fires. Used to notify cab console that it waited to long to respond to a ride request.

doneCommunicating

public void doneCommunicating()
Function called when the cabbie makes and Accept/Reject decision


API documentation for build 958