public void parkVehicle(Vehicle v, int time, int intendedDuration)
			throws SimulationException, VehicleException {
		if (v.isParked() || v.wasParked()) {
			throw new VehicleException("Vehicle cannot park twice.");
		} else if (v.getArrivalTime() > Constants.CLOSING_TIME) {
			throw new VehicleException("CarPark is closed.");
		}

		if (v instanceof Car) {
			if (((Car) v).isSmall()) {
				numSmallCars++;

				/*
				 * If there are any small parks available, fill those first.
				 * Else: Park in a normal park if available.
				 */
				if (smallCarsParked.size() < maxSmallCarSpaces) {
					smallCarsParked.add(v);
				} else if (carsParked.size() < maxCarSpaces) {
					carsParked.add(v);
				} else {
					numCars++;
					if (carsParked.size() < maxCarSpaces) {
						carsParked.add(v);
					}
				}
			}

			else if (v instanceof MotorCycle) {
				numMotorCycles++;
				if (motorCyclesParked.size() < maxMotorCycleSpaces) {
					motorCyclesParked.add(v);
				} else if (smallCarsParked.size() < maxSmallCarSpaces) {
					smallCarsParked.add(v);
				}

			}

		}
		v.enterParkedState(time, intendedDuration);
	}