Package org.epics.util.stats
Class TimeInterval
- java.lang.Object
-
- org.epics.util.stats.TimeInterval
-
public class TimeInterval extends Object
A period of time that spans two instants (included) at the nanosecond precision.- Author:
- carcassi
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static TimeIntervalbetween(Instant start, Instant end)Returns the interval between the given timestamps.booleancontains(Instant instant)True if the given time stamp is inside the interval.booleanequals(Object obj)InstantgetEnd()Final value of the interval.InstantgetStart()Initial value of the interval.inthashCode()TimeIntervalminus(Duration duration)Returns a new interval shifted backward in time by the given duration.StringtoString()
-
-
-
Method Detail
-
contains
public boolean contains(Instant instant)
True if the given time stamp is inside the interval.- Parameters:
instant- a time stamp- Returns:
- true if inside the interval
-
between
public static TimeInterval between(Instant start, Instant end)
Returns the interval between the given timestamps.- Parameters:
start- the beginning of the intervalend- the end of the interval- Returns:
- a new interval
-
minus
public TimeInterval minus(Duration duration)
Returns a new interval shifted backward in time by the given duration.- Parameters:
duration- a time duration- Returns:
- the new shifted interval
-
getStart
public Instant getStart()
Initial value of the interval.- Returns:
- the initial instant
-
getEnd
public Instant getEnd()
Final value of the interval.- Returns:
- the final instant
-
-