diff --git a/src/main/java/edu/iris/dmc/TimeUtil.java b/src/main/java/edu/iris/dmc/TimeUtil.java index d4acf53..7f48447 100644 --- a/src/main/java/edu/iris/dmc/TimeUtil.java +++ b/src/main/java/edu/iris/dmc/TimeUtil.java @@ -75,14 +75,8 @@ public static boolean isBefore(XMLGregorianCalendar one, XMLGregorianCalendar tw } public static int compare(XMLGregorianCalendar one, XMLGregorianCalendar two) { - if (one.toGregorianCalendar().before(two)) { - return -1; - } - - if (one.toGregorianCalendar().after(two)) { - return 1; - } + int result = one.toGregorianCalendar().compareTo(two.toGregorianCalendar()); + return result; - return 0; } } diff --git a/src/main/java/edu/iris/dmc/station/conditions/EpochOverlapCondition.java b/src/main/java/edu/iris/dmc/station/conditions/EpochOverlapCondition.java index 2a74795..914968c 100644 --- a/src/main/java/edu/iris/dmc/station/conditions/EpochOverlapCondition.java +++ b/src/main/java/edu/iris/dmc/station/conditions/EpochOverlapCondition.java @@ -128,6 +128,7 @@ private List checkRanges(List tuples) { Tuple tuple1 = tuples.get(i - 1); Tuple tuple2 = tuples.get(i); if (tuple1.end == null || tuple2.start == null || TimeUtil.isAfter(tuple1.end, tuple2.start)) { + System.out.println(tuple1+" "+tuple2+" "+TimeUtil.isAfter(tuple1.end, tuple2.start)); overlappingDatePairs.add(new Tuple[] { tuple1, tuple2 }); } } @@ -153,6 +154,12 @@ public int compareTo(Tuple other) { return TimeUtil.compare(start, other.start); } + @Override + public String toString() { + return "Tuple [code=" + code + ", location=" + location + ", start=" + start + ", end=" + end + ", index=" + + index + "]"; + } + } }