taxisrus.implementation
Class Zone

java.lang.Object
  |
  +--taxisrus.implementation.Zone
All Implemented Interfaces:
Serializable

public class Zone
extends Object
implements Serializable

Author:
MIKAM Tribe Zone class A Zone contains a list of Cab objects. As of now, all zone information accessed by outside modules will go through the Model object.
See Also:
Serialized Form

Constructor Summary
Zone()
          Zone default constructor -- never call this.
Zone(int zoneID)
          Zone constructor
 
Method Summary
 void addCabToBack(Cab cab)
          Adds an open cab to the back of the cab list within the zone.
 void addCabToFront(Cab cab)
          Adds an open cab to the front of the cab list; for example, if a customer cancels right after the cab is scheduled.
 void clearCabList()
          Clears the cab list.
 Cab getCab(int cabID)
          Returns the cab object corresponding to the cabID.
 Vector getCabList()
          Returns the cab list from the zone.
 Cab getNextCab()
          Removes and returns the next cab.
 int getNumCabs()
          Returns how many cabs are in the zone.
 int getZoneID()
          Returns the zone id.
 Cab removeCab(int cabID)
          Removes a cab from the zone's cab list
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Zone

public Zone()
Zone default constructor -- never call this.

Zone

public Zone(int zoneID)
Zone constructor
Parameters:
zoneID - the ID of this zone
Method Detail

getZoneID

public int getZoneID()
Returns the zone id.
Returns:
the zone ID of this zone

addCabToFront

public void addCabToFront(Cab cab)
Adds an open cab to the front of the cab list; for example, if a customer cancels right after the cab is scheduled. If the cab already exists in the list, the cab is not added. NOTE: The list is NO LONGER sorted by cab priority.
Parameters:
cab - the cab to add to the front of the cab list

addCabToBack

public void addCabToBack(Cab cab)
Adds an open cab to the back of the cab list within the zone. If the cab already exists in the list, the cab is not added. NOTE: The list is NO LONGER sorted by cab priority.
Parameters:
cab - the cab to add to the back of the cab list

getNextCab

public Cab getNextCab()
Removes and returns the next cab. This will possibly be used for manual overrides.
Returns:
the next cab in line

getCabList

public Vector getCabList()
Returns the cab list from the zone.
Returns:
ArrayList of Cabs sorted by priority

getNumCabs

public int getNumCabs()
Returns how many cabs are in the zone.
Returns:
number of cabs in the zone

removeCab

public Cab removeCab(int cabID)
Removes a cab from the zone's cab list
Parameters:
cabID - the cab ID of the cab to remove from zone
Returns:
the cab that was removed from this zone. Returns null if unsuccessful.

getCab

public Cab getCab(int cabID)
Returns the cab object corresponding to the cabID.
Parameters:
cabID - the cab ID of the cab to be retrieve
Returns:
the cab corresponding to the given cab ID. Returns null if there is no cab with given cab ID.

clearCabList

public void clearCabList()
Clears the cab list. This can be used, for example, in case of zone restructuring.


API documentation for build 958