aim4.vehicle

## Class VinRegistry

- java.lang.Object
- - aim4.vehicle.VinRegistry

-     public class VinRegistry
      extends Object

  The Vehicle Registry, the class that issues VIN to vehicles.

- - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `static Road` | `getDestRoadFromVIN(int vin)` Get the destination road from the VIN of a vehicle
    `static SpawnPoint` | `getSpawnPointFromVIN(int vin)` Get a spawn point from the VIN of a vehicle
    `static VehicleSimView` | `getVehicleFromVIN(int vin)` Given a VIN, get the vehicle with that VIN.
    `static VehicleSpec` | `getVehicleSpecFromVIN(int vin)` Given a VIN, get the vehicle specification with that VIN.
    `static boolean` | `isVINexist(int vin)` Whether or not the VIN has been issued.
    `static int` | `registerVehicle(VehicleSimView vehicle)` Put the vehicle to the registry.
    `static boolean` | `registerVehicleWithExistingVIN(VehicleSimView vehicle, int vin)` Register the vehicle with an existing VIN.
    `static void` | `reset()` Reset the registry.
    `static void` | `unregisterVehicle(int vin)` Remove the vehicle from the registry.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Method Detail

    - #### reset

          public static void reset()

      Reset the registry.

    - #### registerVehicle

          public static int registerVehicle(VehicleSimView vehicle)

      Put the vehicle to the registry.
      Parameters:
        `vehicle` - the vehicle
      Returns:
        a new VIN for the vehicle

    - #### registerVehicleWithExistingVIN

          public static boolean registerVehicleWithExistingVIN(VehicleSimView vehicle,
                                               int vin)

      Register the vehicle with an existing VIN.
      Parameters:
        `vehicle` - the vehicle
        `vin` - the given VIN
      Returns:
        true if the VIN has not been issued to other vehicle; false if the VIN has been used by other vehicle.

    - #### unregisterVehicle

          public static void unregisterVehicle(int vin)

      Remove the vehicle from the registry. This function should only be used by BasicVehicle.java
      Parameters:
        `vin` - the VIN of the vehicle

    - #### isVINexist

          public static boolean isVINexist(int vin)

      Whether or not the VIN has been issued.
      Parameters:
        `vin` - the VIN of the vehicle
      Returns:
        whether of not the VIN has been issued.

    - #### getVehicleFromVIN

          public static VehicleSimView getVehicleFromVIN(int vin)

      Given a VIN, get the vehicle with that VIN.
      Parameters:
        `vin` - the VIN of the desired vehicle
      Returns:
        the corresponding vehicle object; null if the vehicle object has been destroyed.

    - #### getVehicleSpecFromVIN

          public static VehicleSpec getVehicleSpecFromVIN(int vin)

      Given a VIN, get the vehicle specification with that VIN.
      Parameters:
        `vin` - the VIN of the desired vehicle
      Returns:
        the corresponding vehicle specification

    - #### getSpawnPointFromVIN

          public static SpawnPoint getSpawnPointFromVIN(int vin)

      Get a spawn point from the VIN of a vehicle
      Parameters:
        `vin` - the VIN of the vehicle
      Returns:
        the spawn point

    - #### getDestRoadFromVIN

          public static Road getDestRoadFromVIN(int vin)

      Get the destination road from the VIN of a vehicle
      Parameters:
        `vin` - the VIN of the vehicle
      Returns:
        the destination road

Copyright © 2013. All rights reserved.