Package org.gephi.graph.api
Class Interval
- java.lang.Object
-
- org.gephi.graph.api.Interval
-
public final class Interval extends Object
Immutable time interval which supports included and excluded bounds.
-
-
Field Summary
Fields Modifier and Type Field Description static Interval
INFINITY_INTERVAL
Infinity interval on both bounds.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compareTo(Double timestamp)
Compares this interval to the given timetamp.int
compareTo(Interval interval)
Compares this interval with the specified interval for order.boolean
equals(Object obj)
Compares this interval with the specified object for equality.double
getHigh()
Returns the right endpoint.double
getLow()
Returns the left endpoint.int
hashCode()
String
toString()
-
-
-
Field Detail
-
INFINITY_INTERVAL
public static final Interval INFINITY_INTERVAL
Infinity interval on both bounds.
-
-
Constructor Detail
-
Interval
public Interval(Interval interval)
Copy constructor.- Parameters:
interval
- interval to copy
-
Interval
public Interval(double low, double high)
Constructor with bounds and whether they are included or excluded.- Parameters:
low
- interval's low boundhigh
- interval's high bound
-
-
Method Detail
-
compareTo
public int compareTo(Interval interval)
Compares this interval with the specified interval for order.Any two intervals i and i' satisfy the interval trichotomy; that is, exactly one of the following three properties holds:
- i and i' overlap
- i is to the left of i'
- i is to the right of i'
Note that if two intervals are equal (
i.low = i'.low
andi.high = i'.high
), they overlap as well. But if they simply overlap (for instancei.low < i'.low
andi.high > i'.high
) they aren't equal.- Parameters:
interval
- the interval to be compared- Returns:
- a negative integer, zero, or a positive integer as this interval is to the left of, overlaps with, or is to the right of the specified interval.
- Throws:
NullPointerException
- ifinterval
is null.
-
compareTo
public int compareTo(Double timestamp)
Compares this interval to the given timetamp.- Parameters:
timestamp
- timestamp- Returns:
- a negative integer, zero or a positive integer if this interval is to the left of, overlaps with, or is to the right with the specified timestamp.
- Throws:
NullPointerException
- iftimestamp
is null.
-
getLow
public double getLow()
Returns the left endpoint.- Returns:
- the left endpoint.
-
getHigh
public double getHigh()
Returns the right endpoint.- Returns:
- the right endpoint.
-
equals
public boolean equals(Object obj)
Compares this interval with the specified object for equality.Note that two intervals are equal if
i.low = i'.low
andi.high = i'.high
.
-
-