if (gapResult != null && !gapResult.contains(clocking)) { return false;
if (gapResult != null) { if (!gapResult.contains(clocking)) { return false; }
    private boolean overlapsSchedule(DateTime clocking,            HashMap<YearMonthDay, WorkSchedule> workScheduleMap) {        WorkSchedule thisDaySchedule = workScheduleMap.get(clocking.toYearMonthDay());        WorkSchedule dayBeforeSchedule = workScheduleMap.get(clocking.toYearMonthDay().minusDays(1));        Interval thisDayWorkTimeInterval = WorkScheduleType                .getDefaultWorkTime(clocking.toYearMonthDay());        if (thisDaySchedule != null) {            DateTime beginThisDayWorkTime = clocking.toYearMonthDay().toDateTime(                    thisDaySchedule.getWorkScheduleType().getWorkTime());            DateTime endThisDayWorkTime = clocking.toYearMonthDay().toDateTime(                    thisDaySchedule.getWorkScheduleType().getWorkEndTime());            if (thisDaySchedule.getWorkScheduleType().isWorkTimeNextDay()) {                endThisDayWorkTime = endThisDayWorkTime.plusDays(1);            }            thisDayWorkTimeInterval = new Interval(beginThisDayWorkTime, endThisDayWorkTime);        }        Interval dayBeforeWorkTimeInterval = WorkScheduleType.getDefaultWorkTime(clocking                .toYearMonthDay().minusDays(1));        if (dayBeforeSchedule != null) {            DateTime beginDayBeforeWorkTime = clocking.toYearMonthDay().toDateTime(                    dayBeforeSchedule.getWorkScheduleType().getWorkTime()).minusDays(1);            DateTime endDayBeforeWorkTime = clocking.toYearMonthDay().toDateTime(                    dayBeforeSchedule.getWorkScheduleType().getWorkEndTime()).minusDays(1);            if (dayBeforeSchedule.getWorkScheduleType().isWorkTimeNextDay()) {                endDayBeforeWorkTime = endDayBeforeWorkTime.plusDays(1);            }            dayBeforeWorkTimeInterval = new Interval(beginDayBeforeWorkTime, endDayBeforeWorkTime);        }        Interval overlapResult = thisDayWorkTimeInterval.overlap(dayBeforeWorkTimeInterval);        if (overlapResult == null) {            Interval gapResult = dayBeforeWorkTimeInterval.gap(thisDayWorkTimeInterval);            if (gapResult != null && !gapResult.contains(clocking)) {                return false;            } else {                return dayBeforeWorkTimeInterval.contains(clocking);            }        } else if (!overlapResult.contains(clocking) && clocking.isAfter(overlapResult.getStart())) {            return false;        }        return true;    }