ro.polak.multilevelcarpark.controllers
Class CarPark

java.lang.Object
  extended by java.lang.Thread
      extended by ro.polak.multilevelcarpark.controllers.CarPark
All Implemented Interfaces:
java.lang.Runnable

public class CarPark
extends java.lang.Thread

The controller for the whole parking, contains other controllers

Author:
Piotr Polak

Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
static GUIDriver gui
          Gui driver for communicating with the GUI (Separate threads)
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
CarPark(int levels, int placesPerRing)
          Default contstructor
 
Method Summary
 Car getCar(java.lang.String carID)
          Finds and returns requested car
 void insertCar(java.lang.String carID)
          Puts the car on the parking place
static void main(java.lang.String[] args)
          The main method running the park
 void run()
          The main method of the thread It loops waiting for messages from GUI
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

gui

public static GUIDriver gui
Gui driver for communicating with the GUI (Separate threads)

Constructor Detail

CarPark

public CarPark(int levels,
               int placesPerRing)
Default contstructor

Parameters:
levels -
placesPerRing -
Method Detail

getCar

public Car getCar(java.lang.String carID)
           throws CarNotFoundException,
                  IllegalOperationException
Finds and returns requested car

Parameters:
carID -
Returns:
Throws:
CarNotFoundException
IllegalOperationException

insertCar

public void insertCar(java.lang.String carID)
               throws NoFreePlacesException,
                      IllegalOperationException
Puts the car on the parking place

Parameters:
car -
Throws:
NoFreePlacesException
IllegalOperationException

run

public void run()
The main method of the thread It loops waiting for messages from GUI

Specified by:
run in interface java.lang.Runnable
Overrides:
run in class java.lang.Thread

main

public static void main(java.lang.String[] args)
The main method running the park

Parameters:
args -