Interface TimeMetric<U,​P>

Type Parameters:
U - generic type of time unit
P - generic type of duration object
All Known Implementing Classes:
AbstractMetric

public interface TimeMetric<U,​P>

Computes temporal distances on a time axis as time spans.

Author:
Meno Hochschild
  • Method Summary

    Modifier and Type
    Method
    Description
    <T extends TimePoint<? super U,​ T>>
    P
    between​(T start, T end)
    Computes the temporal distance between two time points.
    default TimeMetric<U,​P>
    Obtains a modified metric which has reversible characteristics.
  • Method Details

    • between

      <T extends TimePoint<? super U,​ T>> P between(T start, T end)

      Computes the temporal distance between two time points.

      Important note: This method might not work in Java 6 under some circumstances. In case of any problem users can use the equivalent method until() defined in the class TimePoint.

      Type Parameters:
      T - generic type of time point
      Parameters:
      start - first time point
      end - second time point
      Returns:
      calculated time span between given time points, will be negative if start is after end
      See Also:
      TimePoint.until(TimePoint, TimeMetric)
    • reversible

      default TimeMetric<U,​P> reversible()

      Obtains a modified metric which has reversible characteristics.

      Usually metrics are not reversible by default. The default implementation throws an UnsupportedOperationException. Overriding implementations should document the details of reversal characteristics.

      Returns:
      modified reversible time metric
      Throws:
      UnsupportedOperationException - if not supported
      Since:
      5.5