Package com.jalios.util
Class Interval
- java.lang.Object
-
- com.jalios.util.Interval
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.Date
endDate
protected java.lang.Object
linkedElement
protected java.util.Date
startDate
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compareTo(Interval interval)
boolean
equals(java.lang.Object obj)
java.util.Date
getEndDate()
java.lang.Object
getLinkedElement()
java.util.Date
getStartDate()
int
hashCode()
void
merge(Interval interval)
merge two interval which overlaps in oneboolean
overlapWith(Interval other)
Indicates if the two interval overlaps or not (greedy overlap @seeDateUtil.overlapWith(Date, Date, Date, Date, boolean)
boolean
overlapWith(Interval other, boolean greedy)
Indicates if the two interval overlaps or not (greedy overlap @seeDateUtil.overlapWith(Date, Date, Date, Date, boolean)
void
setEndDate(java.util.Date endDate)
void
setLinkedElement(java.lang.Object linkedElement)
void
setStartDate(java.util.Date startDate)
java.lang.String
toString()
-
-
-
Constructor Detail
-
Interval
public Interval(java.util.Date startDate, java.util.Date endDate, java.lang.Object linkedElement)
-
Interval
public Interval(Interval interval)
-
-
Method Detail
-
getLinkedElement
public java.lang.Object getLinkedElement()
- Returns:
- the linkedElement
-
setLinkedElement
public void setLinkedElement(java.lang.Object linkedElement)
- Parameters:
linkedElement
- the linkedElement to set
-
getStartDate
public java.util.Date getStartDate()
- Returns:
- the startDate
-
setStartDate
public void setStartDate(java.util.Date startDate)
- Parameters:
startDate
- the startDate to set
-
getEndDate
public java.util.Date getEndDate()
- Returns:
- the endDate
-
setEndDate
public void setEndDate(java.util.Date endDate)
- Parameters:
endDate
- the endDate to set
-
overlapWith
public boolean overlapWith(Interval other)
Indicates if the two interval overlaps or not (greedy overlap @seeDateUtil.overlapWith(Date, Date, Date, Date, boolean)
- Parameters:
other
- the otherInterval
- Returns:
- true if the interval overlaps, false otherwise
-
overlapWith
public boolean overlapWith(Interval other, boolean greedy)
Indicates if the two interval overlaps or not (greedy overlap @seeDateUtil.overlapWith(Date, Date, Date, Date, boolean)
- Parameters:
other
- the otherInterval
greedy
- indicates if the overlap is greedy or not- Returns:
- true if the interval overlaps, false otherwise
-
compareTo
public int compareTo(Interval interval)
- Specified by:
compareTo
in interfacejava.lang.Comparable<Interval>
-
merge
public void merge(Interval interval)
merge two interval which overlaps in one- Parameters:
interval
- the interval to merge into
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-