Package org.opennms.core.utils
Class TimeInterval
- java.lang.Object
-
- org.opennms.core.utils.TimeInterval
-
- All Implemented Interfaces:
java.lang.Comparable<TimeInterval>
- Direct Known Subclasses:
OwnedInterval
public class TimeInterval extends java.lang.Object implements java.lang.Comparable<TimeInterval>
TimeInterval class.
- Version:
- $Id: $
- Author:
- ranger
-
-
Constructor Summary
Constructors Constructor Description TimeInterval(java.util.Date start, java.util.Date end)
Constructor for TimeInterval.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
comparesTo(java.util.Date date)
Returns -1, 0, 1 based on how date compares to this intervalint
compareTo(TimeInterval t)
compareToboolean
equals(java.lang.Object o)
boolean
follows(TimeInterval interval)
java.util.Date
getEnd()
getEndjava.util.Date
getStart()
getStartint
hashCode()
hashCodeboolean
overlaps(TimeInterval interval)
boolean
preceeds(TimeInterval interval)
java.lang.String
toString()
toString
-
-
-
Method Detail
-
getStart
public java.util.Date getStart()
getStart
- Returns:
- a
Date
object.
-
getEnd
public java.util.Date getEnd()
getEnd
- Returns:
- a
Date
object.
-
comparesTo
public int comparesTo(java.util.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 java.lang.String toString()
toString
- Overrides:
toString
in classjava.lang.Object
- Returns:
- a
String
object.
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
hashCode
- Overrides:
hashCode
in classjava.lang.Object
- Returns:
- a int.
-
compareTo
public int compareTo(TimeInterval t)
compareTo
- Specified by:
compareTo
in interfacejava.lang.Comparable<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)
-
-