FileDocCategorySizeDatePackage
OpMapVector.javaAPI DocJava SE 6 API2853Tue Jun 10 00:23:14 BST 2008com.sun.org.apache.xpath.internal.compiler

OpMapVector

public 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.
xsl.usage
internal

Fields Summary
protected int
m_blocksize
Size of blocks to allocate
protected int[]
m_map
Array of ints
protected int
m_lengthPos
Position where size of array is kept
protected int
m_mapSize
Size of array
Constructors Summary
public OpMapVector(int blocksize, int increaseSize, int lengthPos)
Construct a OpMapVector, using the given block size.

param
blocksize Size of block to allocate

  
                      
        
  

    m_blocksize = increaseSize;
    m_mapSize = blocksize;
    m_lengthPos = lengthPos;
    m_map = new int[blocksize];
  
Methods Summary
public final intelementAt(int i)
Get the nth element.

param
i index of object to get
return
object at given index

    return m_map[i];
  
public final voidsetElementAt(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.

param
value object to set
param
index Index of where to set the object

    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 voidsetToSize(int size)

    
    int newMap[] = new int[size];

    System.arraycopy(m_map, 0, newMap, 0, m_map[m_lengthPos]);

    m_mapSize = size;
    m_map = newMap;