Package org.HdrHistogram.packedarray
Class AbstractPackedLongArray
java.lang.Object
org.HdrHistogram.packedarray.AbstractPackedLongArray
- All Implemented Interfaces:
Serializable,Iterable<Long>
- Direct Known Subclasses:
PackedLongArray
public abstract class AbstractPackedLongArray
extends Object
implements Iterable<Long>, Serializable
A Packed array of signed 64 bit values, and supports
get(), set(),
add() and increment() operations on the logical contents of the array.- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(int index, long value) Add to a value at a virtual index in the arrayvoidadd(AbstractPackedLongArray other) Add the contents of the other array to this onevoidclear()Clear the array contentsabstract AbstractPackedLongArraycopy()Create a copy of this array, complete with data and everything.booleanDetermine if this array is equivalent to another.longget(int index) Get value at virtual index in the arraylongget the end time stamp [optionally] stored with this arrayintGet the current physical length (in longs) of the array's backing storagelongget the start time stamp [optionally] stored with this arrayinthashCode()voidincrement(int index) Increment value at a virtual index in the arrayiterator()An Iterator over all values in the arrayintlength()Get the (virtual) length of the arrayAn Iterator over all non-Zero values in the arrayvoidset(int index, long value) Set the value at a virtual index in the arrayvoidsetEndTimeStamp(long timeStampMsec) Set the end time stamp value associated with this array to a given value.voidsetStartTimeStamp(long timeStampMsec) Set the start time stamp value associated with this array to a given value.abstract voidsetVirtualLength(int newVirtualArrayLength) Set a new virtual length for the array.toString()Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
AbstractPackedLongArray
public AbstractPackedLongArray()
-
-
Method Details
-
getStartTimeStamp
public long getStartTimeStamp()get the start time stamp [optionally] stored with this array- Returns:
- the start time stamp [optionally] stored with this array
-
setStartTimeStamp
public void setStartTimeStamp(long timeStampMsec) Set the start time stamp value associated with this array to a given value.- Parameters:
timeStampMsec- the value to set the time stamp to, [by convention] in msec since the epoch.
-
getEndTimeStamp
public long getEndTimeStamp()get the end time stamp [optionally] stored with this array- Returns:
- the end time stamp [optionally] stored with this array
-
setEndTimeStamp
public void setEndTimeStamp(long timeStampMsec) Set the end time stamp value associated with this array to a given value.- Parameters:
timeStampMsec- the value to set the time stamp to, [by convention] in msec since the epoch.
-
setVirtualLength
public abstract void setVirtualLength(int newVirtualArrayLength) Set a new virtual length for the array.- Parameters:
newVirtualArrayLength- the
-
copy
Create a copy of this array, complete with data and everything.- Returns:
- A distinct copy of this array.
-
toString
-
get
public long get(int index) Get value at virtual index in the array- Parameters:
index- the virtual array index- Returns:
- the array value at the virtual index given
-
increment
public void increment(int index) Increment value at a virtual index in the array- Parameters:
index- virtual index of value to increment
-
add
public void add(int index, long value) Add to a value at a virtual index in the array- Parameters:
index- the virtual index of the value to be added tovalue- the value to add
-
set
public void set(int index, long value) Set the value at a virtual index in the array- Parameters:
index- the virtual index of the value to setvalue- the value to set
-
add
Add the contents of the other array to this one- Parameters:
other- The to add to this array
-
clear
public void clear()Clear the array contents -
getPhysicalLength
public int getPhysicalLength()Get the current physical length (in longs) of the array's backing storage- Returns:
- the current physical length (in longs) of the array's current backing storage
-
length
public int length()Get the (virtual) length of the array- Returns:
- the (virtual) length of the array
-
iterator
An Iterator over all values in the array -
nonZeroValues
An Iterator over all non-Zero values in the array- Returns:
- an Iterator over all non-Zero values in the array
-
equals
Determine if this array is equivalent to another. -
hashCode
public int hashCode()
-