Constructor and Description |
---|
IntervalSet()
Default constructor.
|
IntervalSet(double[] arr)
Constructor with an initial interval set.
|
IntervalSet(int capacity)
Constructor with capacity.
|
Modifier and Type | Method and Description |
---|---|
boolean |
add(Interval interval)
Adds key to this set.
|
void |
clear()
Empties this set.
|
boolean |
contains(double timestamp)
Returns true if this set contains an interval that starts or ends at
timestamp . |
boolean |
contains(Interval interval)
Returns true if this set contains
key . |
boolean |
equals(Object obj) |
double[] |
getIntervals()
Returns an array of all intervals in this set in a flat format.
|
int |
hashCode() |
boolean |
isEmpty()
Returns true if this set is empty.
|
boolean |
remove(Interval interval)
Removes key from this set.
|
int |
size()
Returns the size of this set.
|
Interval[] |
toArray()
Returns an array of all keys in this set.
|
Object |
toPrimitiveArray()
Returns the same result as
TimeSet.toArray() but in a primitive array
if the underlying storage is in a primtive form. |
String |
toString() |
String |
toString(TimeFormat timeFormat) |
String |
toString(TimeFormat timeFormat,
org.joda.time.DateTimeZone timeZone) |
public IntervalSet()
The set is empty with zero capacity.
public IntervalSet(int capacity)
Using this constructor can improve performances if the number of intervals is known in advance as it minimizes array resizes.
capacity
- interval capacitypublic IntervalSet(double[] arr)
The given array must be sorted and containing an even number of elements.
arr
- initial set contentpublic boolean add(Interval interval)
TimeSet
public boolean remove(Interval interval)
TimeSet
public int size()
TimeSet
public boolean isEmpty()
TimeSet
public boolean contains(double timestamp)
timestamp
.timestamp
- timestamppublic boolean contains(Interval interval)
TimeSet
key
.public double[] getIntervals()
The intervals are represented in a flat and sorted array (e.g. {[1.0,2.0], [5.0,6.0]}) returns [1.0,2.0,5.0,6.0]).
This method may return a reference to the underlying array so clients should make a copy if the array is written to.
public Interval[] toArray()
TimeSet
This method may return a reference to the underlying array so clients should make a copy if the array is written to.
public Object toPrimitiveArray()
TimeSet
TimeSet.toArray()
but in a primitive array
if the underlying storage is in a primtive form.toPrimitiveArray
in interface TimeSet<Interval>
public void clear()
TimeSet
public String toString(TimeFormat timeFormat, org.joda.time.DateTimeZone timeZone)
public String toString(TimeFormat timeFormat)
Copyright © 2007–2015 Gephi Consortium. All rights reserved.