com.jalios.util
Class Interval
java.lang.Object
com.jalios.util.Interval
- All Implemented Interfaces:
- Comparable<Interval>
public class Interval
- extends Object
- implements Comparable<Interval>
Interval abstraction (2 dates)
- Author:
- ludovic
startDate
protected Date startDate
endDate
protected Date endDate
linkedElement
protected Object linkedElement
Interval
public Interval(Date startDate,
Date endDate,
Object linkedElement)
Interval
public Interval(Interval interval)
getLinkedElement
public Object getLinkedElement()
- Returns:
- the linkedElement
setLinkedElement
public void setLinkedElement(Object linkedElement)
- Parameters:
linkedElement
- the linkedElement to set
getStartDate
public Date getStartDate()
- Returns:
- the startDate
setStartDate
public void setStartDate(Date startDate)
- Parameters:
startDate
- the startDate to set
getEndDate
public Date getEndDate()
- Returns:
- the endDate
setEndDate
public void setEndDate(Date endDate)
- Parameters:
endDate
- the endDate to set
overlapWith
public boolean overlapWith(Interval other)
- Indicates if the two interval overlaps or not (greedy overlap @see
DateUtil.overlapWith(Date, Date, Date, Date, boolean)
- Parameters:
other
- the other Interval
- 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 @see
DateUtil.overlapWith(Date, Date, Date, Date, boolean)
- Parameters:
other
- the other Interval
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 interface 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 class Object
equals
public boolean equals(Object obj)
- Overrides:
equals
in class Object
toString
public String toString()
- Overrides:
toString
in class Object
Copyright © 2001-2010 Jalios SA. All Rights Reserved.