package com.hashnot.u.range;

import com.google.common.collect.Range;

import java.time.Duration;
import java.time.temporal.Temporal;

/**
 * @author Rafał Krupiński
 */
public class Ranges {
    protected Ranges() {
    }

    public static <ComparableT extends Comparable<ComparableT>, TemporalT extends Temporal & Comparable<ComparableT>> Duration between(Range<TemporalT> timeRange) {
        return Duration.between(timeRange.lowerEndpoint(), timeRange.upperEndpoint());
    }
}

@@ -19,24 +19,68 @@
 t.u.range;%0A%0A
+import com.google.common.collect.BoundType;%0A
 import com.g
@@ -103,24 +103,24 @@
 lect.Range;%0A
-
 %0Aimport java
@@ -239,15 +239,13 @@
   pr
-otec
+iva
 te
-d
  Ran
@@ -248,24 +248,74 @@
  Ranges() %7B%0A
+        throw new RuntimeException(%22Util class%22);%0A
     %7D%0A%0A    p
@@ -470,24 +470,24 @@
 imeRange) %7B%0A
-
         retu
@@ -566,11 +566,292 @@
 );%0A    %7D
+%0A%0A    public static %3CT extends Comparable%3CT%3E%3E boolean isSingleton(Range%3CT%3E range) %7B%0A        return range.upperBoundType() == BoundType.CLOSED%0A                && range.lowerBoundType() == BoundType.CLOSED%0A                && range.lowerEndpoint().equals(range.upperEndpoint());%0A    %7D
 %0A%7D%0A

Add Ranges.isSingleton()