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 intcomparesTo(Date date)Returns -1, 0, 1 based on how date compares to this intervalintcompareTo(TimeInterval t)compareTobooleanequals(Object o)booleanfollows(TimeInterval interval)DategetEnd()getEndDategetStart()getStartinthashCode()hashCodebooleanoverlaps(TimeInterval interval)booleanpreceeds(TimeInterval interval)StringtoString()toString
-
-
-
Method Detail
-
comparesTo
public int comparesTo(Date date)
Returns -1, 0, 1 based on how date compares to this interval- Parameters:
date- aDateobject.- 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:
compareToin interfaceComparable<TimeInterval>- Parameters:
t- aTimeIntervalobject.- Returns:
- a int.
-
preceeds
public boolean preceeds(TimeInterval interval)
-
follows
public boolean follows(TimeInterval interval)
-
overlaps
public boolean overlaps(TimeInterval interval)
-
-