Package org.gephi.graph.api.types
Class TimestampSet
- java.lang.Object
-
- org.gephi.graph.api.types.TimestampSet
-
-
Constructor Summary
Constructors Constructor Description TimestampSet()Default constructor.TimestampSet(double[] arr)Constructor with an initial timestamp set.TimestampSet(int capacity)Constructor with capacity.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanadd(Double timestamp)Adds key to this set.voidclear()Empties this set.booleancontains(Double timestamp)Returns true if this set containskey.booleanequals(Object obj)DoublegetMax()Returns the maximum key in the setDoublegetMaxDouble()Returns the maximum timestamp in the setDoublegetMin()Returns the minimum key in the setDoublegetMinDouble()Returns the minimum timestamp in the setinthashCode()booleanisEmpty()Returns true if this set is empty.booleanremove(Double timestamp)Removes key from this set.intsize()Returns the size of this set.Double[]toArray()Returns an array of all keys in this set.double[]toPrimitiveArray()Returns the same result asTimeSet.toArray()but in a primitive array if the underlying storage is in a primitive form.StringtoString()StringtoString(TimeFormat timeFormat)Returns this set as a string.StringtoString(TimeFormat timeFormat, org.joda.time.DateTimeZone timeZone)Returns this set as a string.
-
-
-
Constructor Detail
-
TimestampSet
public TimestampSet()
Default constructor.The set is empty with zero capacity.
-
TimestampSet
public TimestampSet(int capacity)
Constructor with capacity.Using this constructor can improve performances if the number of timestamps is known in advance as it minimizes array resizes.
- Parameters:
capacity- timestamp capacity
-
TimestampSet
public TimestampSet(double[] arr)
Constructor with an initial timestamp set.The given array must be sorted and contain no duplicates.
- Parameters:
arr- initial set content
-
-
Method Detail
-
add
public boolean add(Double timestamp)
Description copied from interface:TimeSetAdds key to this set.
-
remove
public boolean remove(Double timestamp)
Description copied from interface:TimeSetRemoves key from this set.
-
size
public int size()
Description copied from interface:TimeSetReturns the size of this set.
-
isEmpty
public boolean isEmpty()
Description copied from interface:TimeSetReturns true if this set is empty.
-
getMax
public Double getMax()
Description copied from interface:TimeSetReturns the maximum key in the set
-
getMin
public Double getMin()
Description copied from interface:TimeSetReturns the minimum key in the set
-
getMaxDouble
public Double getMaxDouble()
Description copied from interface:TimeSetReturns the maximum timestamp in the set- Specified by:
getMaxDoublein interfaceTimeSet<Double>- Returns:
- maximum timestamp, or null if the set is empty.
-
getMinDouble
public Double getMinDouble()
Description copied from interface:TimeSetReturns the minimum timestamp in the set- Specified by:
getMinDoublein interfaceTimeSet<Double>- Returns:
- minimum timestamp, or null if the set is empty.
-
contains
public boolean contains(Double timestamp)
Description copied from interface:TimeSetReturns true if this set containskey.
-
toArray
public Double[] toArray()
Description copied from interface:TimeSetReturns an array of all keys in this set.This method may return a reference to the underlying array so clients should make a copy if the array is written to.
-
toPrimitiveArray
public double[] toPrimitiveArray()
Description copied from interface:TimeSetReturns the same result asTimeSet.toArray()but in a primitive array if the underlying storage is in a primitive form.- Specified by:
toPrimitiveArrayin interfaceTimeSet<Double>- Returns:
- array of all keys
-
clear
public void clear()
Description copied from interface:TimeSetEmpties this set.
-
toString
public String toString(TimeFormat timeFormat, org.joda.time.DateTimeZone timeZone)
Description copied from interface:TimeSetReturns this set as a string.
-
toString
public String toString(TimeFormat timeFormat)
Description copied from interface:TimeSetReturns this set as a string.
-
-