1 16 19 20 package com.sun.org.apache.xpath.internal.compiler; 21 22 29 public class OpMapVector { 30 31 32 protected int m_blocksize; 33 34 35 protected int m_map[]; 37 38 protected int m_lengthPos = 0; 39 40 41 protected int m_mapSize; 42 43 48 public OpMapVector(int blocksize, int increaseSize, int lengthPos) 49 { 50 51 m_blocksize = increaseSize; 52 m_mapSize = blocksize; 53 m_lengthPos = lengthPos; 54 m_map = new int[blocksize]; 55 } 56 57 64 public final int elementAt(int i) 65 { 66 return m_map[i]; 67 } 68 69 79 public final void setElementAt(int value, int index) 80 { 81 if (index >= m_mapSize) 82 { 83 int oldSize = m_mapSize; 84 85 m_mapSize += m_blocksize; 86 87 int newMap[] = new int[m_mapSize]; 88 89 System.arraycopy(m_map, 0, newMap, 0, oldSize); 90 91 m_map = newMap; 92 } 93 94 m_map[index] = value; 95 } 96 97 98 103 public final void setToSize(int size) { 104 105 int newMap[] = new int[size]; 106 107 System.arraycopy(m_map, 0, newMap, 0, m_map[m_lengthPos]); 108 109 m_mapSize = size; 110 m_map = newMap; 111 112 } 113 114 } 115 | Popular Tags |