2 * Copyright 2000-2021 Vaadin Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5 * use this file except in compliance with the License. You may obtain a copy of
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 * License for the specific language governing permissions and limitations under
16 package com.vaadin.v7.client.ui.calendar.schedule;
18 import java.util.Date;
21 * Internally used by the calendar.
25 public class WeekGridMinuteTimeRange {
26 private final Date start;
27 private final Date end;
30 * Creates a Date time range between start and end date. Drops seconds from
34 * Start time of the range
36 * End time of the range
38 public WeekGridMinuteTimeRange(Date start, Date end) {
39 this.start = new Date(start.getTime());
40 this.end = new Date(end.getTime());
41 this.start.setSeconds(0);
42 this.end.setSeconds(0);
45 public Date getStart() {
49 public Date getEnd() {
53 public static boolean doesOverlap(WeekGridMinuteTimeRange a,
54 WeekGridMinuteTimeRange b) {
55 boolean overlaps = a.getStart().compareTo(b.getEnd()) < 0
56 && a.getEnd().compareTo(b.getStart()) > 0;