OpMapVectorpublic class OpMapVector extends Object Like IntVector, but used only for the OpMap array. Length of array
is kept in the m_lengthPos position of the array. Only the required methods
are in included here. |
Fields Summary |
---|
protected int | m_blocksizeSize of blocks to allocate | protected int[] | m_mapArray of ints | protected int | m_lengthPosPosition where size of array is kept | protected int | m_mapSizeSize of array |
Constructors Summary |
---|
public OpMapVector(int blocksize, int increaseSize, int lengthPos)Construct a OpMapVector, using the given block size.
m_blocksize = increaseSize;
m_mapSize = blocksize;
m_lengthPos = lengthPos;
m_map = new int[blocksize];
|
Methods Summary |
---|
public final int | elementAt(int i)Get the nth element.
return m_map[i];
| public final void | setElementAt(int value, int index)Sets the component at the specified index of this vector to be the
specified object. The previous component at that position is discarded.
The index must be a value greater than or equal to 0 and less
than the current size of the vector.
if (index >= m_mapSize)
{
int oldSize = m_mapSize;
m_mapSize += m_blocksize;
int newMap[] = new int[m_mapSize];
System.arraycopy(m_map, 0, newMap, 0, oldSize);
m_map = newMap;
}
m_map[index] = value;
| public final void | setToSize(int size)
int newMap[] = new int[size];
System.arraycopy(m_map, 0, newMap, 0, m_map[m_lengthPos]);
m_mapSize = size;
m_map = newMap;
|
|