Cytoscape 2.6.2 (c) 2006,2007 ISB, MSKCC, UCSD

cytoscape.util.intr
Class IntArray

java.lang.Object
  extended by cytoscape.util.intr.IntArray
All Implemented Interfaces:
Serializable

public final class IntArray
extends Object
implements Serializable

A dynamically growing array of integers. Valid indices of this array are in the range [0, Integer.MAX_VALUE - 1].

In the underlying implementation, this dynamically growing array increases in size to adapt to elements being added (the size of the underlying data structure supporting this dynamically growing array is invisible to the programmer). In the underlying implementation, this dynamic array never decreases in size. Underlying size expansions are implemented such that the operation of expanding in size is amortized over the constant time complexity of inserting new elements into this dynamic array.

An instance of this class is serializable; however, serialized instances of this class should not be stored in a persistent manner because the serialization implemented in this class makes no attempt at handling class versioning.

See Also:
Serialized Form

Constructor Summary
IntArray()
          Creates a new IntArray object.
 
Method Summary
 int getIntAtIndex(int index)
          Returns the value at specified index.
 void setIntAtIndex(int value, int index)
          Sets the specified value at specified index.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IntArray

public IntArray()
Creates a new IntArray object.

Method Detail

getIntAtIndex

public final int getIntAtIndex(int index)
Returns the value at specified index. This method will not increase the size of the underlying array, no matter what. The value returned by this method will be 0 unless a value at given index has been previously specified with setIntAtIndex(int, int).

Throws:
ArrayIndexOutOfBoundsException - if index is negative or Integer.MAX_VALUE.

setIntAtIndex

public final void setIntAtIndex(int value,
                                int index)
Sets the specified value at specified index. This method will potentially increase the size of the underlying array, but only if two conditions hold: 1. value is not zero and 2. index is greater than or equal to the length of the underlying array.

NOTE: Setting very large indices to non-zero values implies instantiating a very large underlying data structure.

Throws:
ArrayIndexOutOfBoundsException - if index is negative or Integer.MAX_VALUE.

www.cytoscape.org