/** * do I overlap this other range at all? * * @param range: * the time range to check for overlap * @return true if any time in range is in my range is in the other range, false if not */ public boolean overlaps(TimeRange range) { boolean overlaps = false; // null range? // if my start is in the other range if (range.contains(firstTime())) { overlaps = true; } // if my end is in the other range else if (range.contains(lastTime())) { overlaps = true; } // if I contain the other range else if (contains(range)) { overlaps = true; } return overlaps; } // overlaps