Package org.opennms.core.utils
Class TimeInterval
- java.lang.Object
-
- org.opennms.core.utils.TimeInterval
-
- All Implemented Interfaces:
Comparable<TimeInterval>
- Direct Known Subclasses:
OwnedInterval
public class TimeInterval extends Object implements Comparable<TimeInterval>
TimeInterval class.
- Version:
- $Id: $
- Author:
- ranger
-
-
Constructor Summary
Constructors Constructor Description TimeInterval(Date start, Date end)
Constructor for TimeInterval.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
comparesTo(Date date)
Returns -1, 0, 1 based on how date compares to this intervalint
compareTo(TimeInterval t)
compareToboolean
equals(Object o)
boolean
follows(TimeInterval interval)
Date
getEnd()
getEndDate
getStart()
getStartint
hashCode()
hashCodeboolean
overlaps(TimeInterval interval)
boolean
preceeds(TimeInterval interval)
String
toString()
toString
-
-
-
Method Detail
-
comparesTo
public int comparesTo(Date date)
Returns -1, 0, 1 based on how date compares to this interval- Parameters:
date
- aDate
object.- Returns:
- -1 if the interval is entirely before date, 0 if the interval contains date, 1 if the interface entirely follows date, for these the starting date is included the ending date excluded
-
toString
public String toString()
toString
-
compareTo
public int compareTo(TimeInterval t)
compareTo
- Specified by:
compareTo
in interfaceComparable<TimeInterval>
- Parameters:
t
- aTimeInterval
object.- Returns:
- a int.
-
preceeds
public boolean preceeds(TimeInterval interval)
-
follows
public boolean follows(TimeInterval interval)
-
overlaps
public boolean overlaps(TimeInterval interval)
-
-