1 package org.apidesign.apifest08.currency;
6 * Date util helper class.
11 private DateUtil() {};
13 static boolean isInRange(Date instant, Date from, Date till) {
14 if ((from == null || instant.equals(from) || instant.after(from)) &&
15 (till == null || instant.before(till))) {
22 static boolean isRangesOverlapping(Date fromA, Date tillA, Date fromB, Date tillB) {
23 if ((fromA == null && tillA == null) || (fromB == null && tillB == null)) {
26 if (fromA != null && isInRange(fromA, fromB, tillB)) {
29 if (tillA != null && !tillA.equals(fromB) && isInRange(tillA, fromB, tillB)) {
32 if (fromB != null && isInRange(fromB, fromA, tillA)) {
35 if (tillB != null && !tillB.equals(fromA) && isInRange(tillB, fromA, tillA)) {
41 static Date getRangesIntersectionBottom(Date fromA, Date fromB) {
48 if (fromA.after(fromB)) {
55 static Date getRangesIntersectionTop(Date tillA, Date tillB) {
62 if (tillA.before(tillB)) {