aim4.im.v2i.reservation
Class AdmissionControlZone

java.lang.Object
  extended by aim4.im.v2i.reservation.AdmissionControlZone

public class AdmissionControlZone
extends Object

This is a data structure to manage the admission control zone, the area after an intersection in one lane. It essentially holds a limited length's worth of vehicles and will only admit vehicles if there is enough room.


Constructor Summary
AdmissionControlZone(double maxSize)
          Construct a new AdmissionControlZone with the given maximum length.
 
Method Summary
 void admit(int vin, double vehicleLength, double stoppingDistance)
          Reserve space for a vehicle to enter this admission control zone.
 void away(int vin)
          Indicates that the vehicle with the given ID number has left the admission control zone by driving out of it within the lane.
 void cancel(int vin)
          Indicates that the vehicle with the given ID number no longer wants to enter this AdmissionControlZone.
 double getCurrentSize()
          Get the current size of the admission control zone.
 double getMaxSize()
          Get the maximum length's worth of vehicles allowed in this admission control zone at one time.
 boolean isAdmissible(int vin, double vehicleLength, double stoppingDistance)
          Check to see if the vehicle can reserve space to enter this admission control zone.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AdmissionControlZone

public AdmissionControlZone(double maxSize)
Construct a new AdmissionControlZone with the given maximum length.

Parameters:
maxSize - the maximum length's worth of cars that the zone will hold
Method Detail

getMaxSize

public double getMaxSize()
Get the maximum length's worth of vehicles allowed in this admission control zone at one time.

Returns:
the maximum length's worth of vehicles allowed in this AdmissionControlZone at one time

getCurrentSize

public double getCurrentSize()
Get the current size of the admission control zone.

Returns:
the current size of the admission control zone.

isAdmissible

public boolean isAdmissible(int vin,
                            double vehicleLength,
                            double stoppingDistance)
Check to see if the vehicle can reserve space to enter this admission control zone.

Parameters:
vin - the VIN number of the vehicle to try to add
vehicleLength - the length of the vehicle to try to add
stoppingDistance - the distance it will take the vehicle to stop if it begins decelerating as soon as it enters the admission control zone
Returns:
whether or not the vehicle can be successfully added

admit

public void admit(int vin,
                  double vehicleLength,
                  double stoppingDistance)
Reserve space for a vehicle to enter this admission control zone.

Parameters:
vin - the VIN number of the vehicle to try to add
vehicleLength - the length of the vehicle to try to add
stoppingDistance - the distance it will take the vehicle to stop if it begins decelerating as soon as it enters the admission control zone

cancel

public void cancel(int vin)
Indicates that the vehicle with the given ID number no longer wants to enter this AdmissionControlZone.

Parameters:
vin - the ID number of the vehicle canceling

away

public void away(int vin)
Indicates that the vehicle with the given ID number has left the admission control zone by driving out of it within the lane.

Parameters:
vin - the ID number of the vehicle to remove


Copyright © 2011. All Rights Reserved.