Class Interval
- java.lang.Object
-
- org.processmining.servicelevelagreements.model.interval.Interval
-
public class Interval extends java.lang.ObjectRepresents the, possibly empty, possibly open-ended (end timestamp is infinite), closed-open interval[startTimestamp, endTimestamp).- Author:
- B.F.A. Hompes
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancontainsInterval(Interval other)Checks whether this interval contains the specified interval.booleancontainsTimestamp(long timestamp)Checks whether this interval contains the specified timestamp.booleanequals(java.lang.Object obj)longgetEndTimestamp()longgetLength()Get's the length of the interval.longgetStartTimestamp()inthashCode()booleanisEmpty()booleanisOpenEnded()voidsetEmpty(boolean empty)voidsetEndTimestamp(long timestamp)voidsetOpenEnded(boolean openEnded)voidsetStartTimestamp(long timestamp)java.lang.StringtoString()
-
-
-
Constructor Detail
-
Interval
public Interval()
Constructor for empty interval.
-
Interval
public Interval(long startTimestamp)
Constructor for interval with open end.- Parameters:
startTimestamp-
-
Interval
public Interval(long startTimestamp, long endTimestamp)Constructor for interval with closed end.- Parameters:
startTimestamp-endTimestamp-
-
Interval
public Interval(Interval other)
-
-
Method Detail
-
getStartTimestamp
public long getStartTimestamp()
-
setStartTimestamp
public void setStartTimestamp(long timestamp)
-
getEndTimestamp
public long getEndTimestamp()
-
setEndTimestamp
public void setEndTimestamp(long timestamp)
-
isEmpty
public boolean isEmpty()
-
setEmpty
public void setEmpty(boolean empty)
-
isOpenEnded
public boolean isOpenEnded()
-
setOpenEnded
public void setOpenEnded(boolean openEnded)
-
getLength
public long getLength()
Get's the length of the interval.- Returns:
- -1 in case the interval is open ended or the difference between end and start timestamp in case the interval is closed.
-
containsTimestamp
public boolean containsTimestamp(long timestamp)
Checks whether this interval contains the specified timestamp.- Parameters:
timestamp- The timestamp- Returns:
- True if the timestamp is contained in the interval, false otherwise.
-
containsInterval
public boolean containsInterval(Interval other)
Checks whether this interval contains the specified interval.- Parameters:
other- The other interval- Returns:
- True if the other interval is contained in this interval, false otherwise.
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-