public String getTaskAtTime(int time) {
		if (this.initialized == false) {
			throw new IllegalStateException("Aperiodic task queues must be initialized before they can be used.");
		}
		String taskName = null;
		if (schedule.isEmpty() == false) {
			if (time >= schedule.peek().getStartTime()) {
				taskName = schedule.removeFirst().getName();
				if (tasks.get(taskName).getTimeStarted() == -1) {
					tasks.get(taskName).setTimeStarted(time);
				}
				if (schedule.isEmpty()) {
					tasks.get(taskName).setTimeEnded(time + 1);
				} else {
					if (schedule.peek().getName().equals(taskName) == false) {
						tasks.get(taskName).setTimeEnded(time + 1);
					}
				}
			}
		}

		return taskName;
	}