public Task getRunningTask() { ArrayList thePeriods = getAllPeriods(); Period thePeriod = null; for (int i = 0; i < thePeriods.size(); i++) { thePeriod = (Period) thePeriods.get(i); if (thePeriod.getEndTime() == -1) { return thePeriod.getTask(); } } return null; }