Top Description Inners Fields Constructors Methods
org.HdrHistogram.packedarray

pack-priv abstract Class AbstractPackedLongArray

extends Object
implements Iterable<Long>, Serializable
Class Inheritance
All Implemented Interfaces
java.io.Serializable, java.lang.Iterable
Known Direct Subclasses
org.HdrHistogram.packedarray.PackedLongArray
Imports
java.io.Serializable, java.util.Iterator, .NoSuchElementException

A Packed array of signed 64 bit values, and supports get(), set(), add() and increment() operations on the logical contents of the array.

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv class

Field Summary

Modifier and TypeField and Description
private AbstractPackedArrayContext
private long
pack-priv static final int
private static final int
NUMBER_OF_SETS

An AbstractPackedLongArray Uses AbstractPackedArrayContext to track the array's logical contents.

private long

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public void
add(final int
the virtual index of the value to be added to
index
,
final long
the value to add
value
)

Add to a value at a virtual index in the array

public void
add(final AbstractPackedLongArray
The to add to this array
other
)

Add the contents of the other array to this one

public void
clear()

Clear the array contents

pack-priv abstract void
public abstract AbstractPackedLongArray

Returns:

A distinct copy of this array.
copy
()

Create a copy of this array, complete with data and everything.

pack-priv abstract long
pack-priv abstract void
criticalSectionExit(long criticalValueAtEnter)

public boolean

Returns:

True if this array are equivalent with the other.
equals
(final Object
the other array to compare to
other
)

Overrides java.lang.Object.equals.

Determine if this array is equivalent to another.
public long

Returns:

the array value at the virtual index given
get
(final int
the virtual array index
index
)

Get value at virtual index in the array

pack-priv AbstractPackedArrayContext
public long

Returns:

the end time stamp [optionally] stored with this array
getEndTimeStamp
()

get the end time stamp [optionally] stored with this array

public int

Returns:

the current physical length (in longs) of the array's current backing storage
getPhysicalLength
()

Get the current physical length (in longs) of the array's backing storage

public long

Returns:

the start time stamp [optionally] stored with this array
getStartTimeStamp
()

get the start time stamp [optionally] stored with this array

public int
hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code value for the object.
public void
increment(final int
virtual index of value to increment
index
)

Increment value at a virrual index in the array

public Iterator<Long>

Returns:

an Iterator over all values in the array
iterator
()

Implements java.lang.Iterable.iterator.

An Iterator over all values in the array
public int

Returns:

the (virtual) length of the array
length
()

Get the (virtual) length of the array

public Iterable<IterationValue>

Returns:

an Iterator over all non-Zero values in the array
nonZeroValues
()

An Iterator over all non-Zero values in the array

private int
oneAtATimeHashStep(final int incomingHash, final int v)

pack-priv abstract void
resizeStorageArray(int newPhysicalLengthInLongs)

public void
set(final int
the virtual index of the value to set
index
,
final long
the value to set
value
)

Set the value at a virtual index in the array

pack-priv void
public void
setEndTimeStamp(final long
the value to set the time stamp to, [by convention] in msec since the epoch.
timeStampMsec
)

Set the end time stamp value associated with this array to a given value.

public void
setStartTimeStamp(final long
the value to set the time stamp to, [by convention] in msec since the epoch.
timeStampMsec
)

Set the start time stamp value associated with this array to a given value.

public abstract void
setVirtualLength(final int
the
newVirtualArrayLength
)

Set a new virtual length for the array.

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAllwaitwaitwait

Field Detail

arrayContextback to summary
private AbstractPackedArrayContext arrayContext
endTimeStampMsecback to summary
private long endTimeStampMsec
NUMBER_OF_NON_ZEROS_TO_HASHback to summary
pack-priv static final int NUMBER_OF_NON_ZEROS_TO_HASH
NUMBER_OF_SETSback to summary
private static final int NUMBER_OF_SETS

An AbstractPackedLongArray Uses AbstractPackedArrayContext to track the array's logical contents. Contexts may be switched when a context requires resizing to complete logical array operations (get, set, add, increment). Contexts are established and used within critical sections in order to facilitate concurrent implementors.

startTimeStampMsecback to summary
private long startTimeStampMsec

Constructor Detail

AbstractPackedLongArrayback to summary
pack-priv AbstractPackedLongArray()

Method Detail

addback to summary
public void add(final int index, final long value)

Add to a value at a virtual index in the array

Parameters
index:int

the virtual index of the value to be added to

value:long

the value to add

addback to summary
public void add(final AbstractPackedLongArray other)

Add the contents of the other array to this one

Parameters
other:AbstractPackedLongArray

The to add to this array

clearback to summary
public void clear()

Clear the array contents

clearContentsback to summary
pack-priv abstract void clearContents()
copyback to summary
public abstract AbstractPackedLongArray copy()

Create a copy of this array, complete with data and everything.

Returns:AbstractPackedLongArray

A distinct copy of this array.

criticalSectionEnterback to summary
pack-priv abstract long criticalSectionEnter()
criticalSectionExitback to summary
pack-priv abstract void criticalSectionExit(long criticalValueAtEnter)
equalsback to summary
public boolean equals(final Object other)

Overrides java.lang.Object.equals.

Determine if this array is equivalent to another.

Parameters
other:Object

the other array to compare to

Returns:boolean

True if this array are equivalent with the other.

Annotations
@Override
getback to summary
public long get(final int index)

Get value at virtual index in the array

Parameters
index:int

the virtual array index

Returns:long

the array value at the virtual index given

getArrayContextback to summary
pack-priv AbstractPackedArrayContext getArrayContext()
getEndTimeStampback to summary
public long getEndTimeStamp()

get the end time stamp [optionally] stored with this array

Returns:long

the end time stamp [optionally] stored with this array

getPhysicalLengthback to summary
public int getPhysicalLength()

Get the current physical length (in longs) of the array's backing storage

Returns:int

the current physical length (in longs) of the array's current backing storage

getStartTimeStampback to summary
public long getStartTimeStamp()

get the start time stamp [optionally] stored with this array

Returns:long

the start time stamp [optionally] stored with this array

hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Doc from java.lang.Object.hashCode.

Returns a hash code value for the object. This method is supported for the benefit of hash tables such as those provided by java.util.HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
Returns:int

a hash code value for this object.

Annotations
@Override
incrementback to summary
public void increment(final int index)

Increment value at a virrual index in the array

Parameters
index:int

virtual index of value to increment

iteratorback to summary
public Iterator<Long> iterator()

Implements java.lang.Iterable.iterator.

An Iterator over all values in the array

Returns:Iterator<Long>

an Iterator over all values in the array

lengthback to summary
public int length()

Get the (virtual) length of the array

Returns:int

the (virtual) length of the array

nonZeroValuesback to summary
public Iterable<IterationValue> nonZeroValues()

An Iterator over all non-Zero values in the array

Returns:Iterable<IterationValue>

an Iterator over all non-Zero values in the array

oneAtATimeHashStepback to summary
private int oneAtATimeHashStep(final int incomingHash, final int v)
resizeStorageArrayback to summary
pack-priv abstract void resizeStorageArray(int newPhysicalLengthInLongs)
setback to summary
public void set(final int index, final long value)

Set the value at a virtual index in the array

Parameters
index:int

the virtual index of the value to set

value:long

the value to set

setArrayContextback to summary
pack-priv void setArrayContext(AbstractPackedArrayContext newArrayContext)
setEndTimeStampback to summary
public void setEndTimeStamp(final long timeStampMsec)

Set the end time stamp value associated with this array to a given value.

Parameters
timeStampMsec:long

the value to set the time stamp to, [by convention] in msec since the epoch.

setStartTimeStampback to summary
public void setStartTimeStamp(final long timeStampMsec)

Set the start time stamp value associated with this array to a given value.

Parameters
timeStampMsec:long

the value to set the time stamp to, [by convention] in msec since the epoch.

setVirtualLengthback to summary
public abstract void setVirtualLength(final int newVirtualArrayLength)

Set a new virtual length for the array.

Parameters
newVirtualArrayLength:int

the

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object.

Annotations
@Override
org.HdrHistogram.packedarray back to summary

pack-priv Class AbstractPackedLongArray.AllValuesIterator

extends Object
implements Iterator<Long>
Class Inheritance
  • java.lang.Object
  • org.HdrHistogram.packedarray.AbstractPackedLongArray.AllValuesIterator
All Implemented Interfaces
java.util.Iterator

Field Summary

Modifier and TypeField and Description
pack-priv int

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public boolean
hasNext()

Implements java.util.Iterator.hasNext.

Returns true if the iteration has more elements.
public Long
next()

Implements java.util.Iterator.next.

Returns the next element in the iteration.
public void
remove()

Overrides default java.util.Iterator.remove.

Removes from the underlying collection the last element returned by this iterator (optional operation).
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

nextVirtrualIndexback to summary
pack-priv int nextVirtrualIndex

Constructor Detail

AllValuesIteratorback to summary
pack-priv AllValuesIterator()

Method Detail

hasNextback to summary
public boolean hasNext()

Implements java.util.Iterator.hasNext.

Doc from java.util.Iterator.hasNext.

Returns true if the iteration has more elements. (In other words, returns true if next would return an element rather than throwing an exception.)

Returns:boolean

true if the iteration has more elements

Annotations
@Override
nextback to summary
public Long next()

Implements java.util.Iterator.next.

Doc from java.util.Iterator.next.

Returns the next element in the iteration.

Returns:Long

the next element in the iteration

Annotations
@Override
removeback to summary
public void remove()

Overrides default java.util.Iterator.remove.

Doc from java.util.Iterator.remove.

Removes from the underlying collection the last element returned by this iterator (optional operation). This method can be called only once per call to next.

The behavior of an iterator is unspecified if the underlying collection is modified while the iteration is in progress in any way other than by calling this method, unless an overriding class has specified a concurrent modification policy.

The behavior of an iterator is unspecified if this method is called after a call to the forEachRemaining method.

Annotations
@Override