1 18 package org.objectweb.speedo.genclass.collection; 19 20 import org.objectweb.speedo.genclass.api.SpeedoGenClassProxy; 21 import org.objectweb.speedo.mim.api.SpeedoAccessor; 22 23 import java.util.Collection ; 24 import java.util.Iterator ; 25 import java.util.List ; 26 import java.util.ListIterator ; 27 import java.util.Vector ; 28 29 33 public abstract class VectorImpl extends Vector 34 implements SpeedoGenClassProxy { 35 36 public VectorImpl() { 37 super(); 38 accessor = (ListAccessor) createAccessor(); 39 } 40 41 ListAccessor accessor; 42 43 public SpeedoAccessor getReferenceAccessor() { 44 return accessor; 45 } 46 public void setReferenceAccessor(SpeedoAccessor refAcc) { 47 accessor = (ListAccessor) refAcc; 48 } 49 50 53 public boolean add(Object o) { 54 boolean result; 55 if (!jdoIsActive()) { 56 result = accessor.add(o); 57 } else { 58 ListAccessor ca = (ListAccessor) getSpeedoHome().writeIntention(this, null); 59 result = ca.add(o); 60 } 61 return result; 62 } 63 64 public boolean addAll(Collection c) { 65 boolean result; 66 if (!jdoIsActive()) { 67 result = accessor.addAll(c); 68 } else { 69 ListAccessor ca = (ListAccessor) getSpeedoHome().writeIntention(this, null); 70 result = ca.addAll(c); 71 } 72 return result; 73 } 74 75 public void clear() { 76 if (!jdoIsActive()) { 77 accessor.clear(); 78 } else { 79 ListAccessor ca = (ListAccessor) getSpeedoHome().writeIntention(this, null); 80 ca.clear(); 81 } 82 } 83 84 public boolean contains(Object o) { 85 if (!jdoIsActive()) { 86 return accessor.contains(o); 87 } else { 88 ListAccessor ca = (ListAccessor) getSpeedoHome().readIntention(this, null); 89 return ca.contains(o); 90 } 91 } 92 93 public boolean containsAll(Collection c) { 94 if (!jdoIsActive()) { 95 return accessor.containsAll(c); 96 } else { 97 ListAccessor ca = (ListAccessor) getSpeedoHome().readIntention(this, null); 98 return ca.containsAll(c); 99 } 100 } 101 102 public boolean equals(Object o) { 103 if (!jdoIsActive()) { 104 return accessor.equals(o); 105 } else { 106 ListAccessor ca = (ListAccessor) getSpeedoHome().readIntention(this, null); 107 return ca.equals(o); 108 } 109 } 110 111 public boolean isEmpty() { 112 if (!jdoIsActive()) { 113 return accessor.isEmpty(); 114 } else { 115 ListAccessor ca = (ListAccessor) getSpeedoHome().readIntention(this, null); 116 return ca.isEmpty(); 117 } 118 } 119 120 public Iterator iterator() { 121 if (!jdoIsActive()) { 122 return accessor.iterator(); 123 } else { 124 ListAccessor ca = (ListAccessor) getSpeedoHome().readIntention(this, null); 125 return ca.iterator(); 126 } 127 } 128 129 public boolean remove(Object o) { 130 boolean result; 131 if (!jdoIsActive()) { 132 result = accessor.remove(o); 133 } else { 134 ListAccessor ca = (ListAccessor) getSpeedoHome().writeIntention(this, null); 135 result = ca.remove(o); 136 } 137 return result; 138 } 139 140 public boolean removeAll(Collection c) { 141 boolean result; 142 if (!jdoIsActive()) { 143 result = accessor.removeAll(c); 144 } else { 145 ListAccessor ca = (ListAccessor) getSpeedoHome().writeIntention(this, null); 146 result = ca.removeAll(c); 147 } 148 return result; 149 } 150 151 public boolean retainAll(Collection c) { 152 throw new UnsupportedOperationException (); 153 } 154 155 public int size() { 156 if (!jdoIsActive()) { 157 return accessor.size(); 158 } else { 159 ListAccessor ca = (ListAccessor) getSpeedoHome().readIntention(this, null); 160 return ca.size(); 161 } 162 } 163 164 public Object [] toArray() { 165 if (!jdoIsActive()) { 166 return accessor.toArray(); 167 } else { 168 ListAccessor ca = (ListAccessor) getSpeedoHome().readIntention(this, null); 169 return ca.toArray(); 170 } 171 } 172 173 public Object [] toArray(Object [] a) { 174 if (!jdoIsActive()) { 175 return accessor.toArray(a); 176 } else { 177 ListAccessor ca = (ListAccessor) getSpeedoHome().readIntention(this, null); 178 return ca.toArray(a); 179 } 180 } 181 public void add(int index, Object element) { 182 if (!jdoIsActive()) { 183 accessor.add(index, element); 184 } else { 185 ListAccessor ca = (ListAccessor) getSpeedoHome().readIntention(this, null); 186 ca.add(index, element); 187 } 188 } 189 public boolean addAll(int index, Collection c) { 190 if (!jdoIsActive()) { 191 return accessor.addAll(index, c); 192 } else { 193 ListAccessor ca = (ListAccessor) getSpeedoHome().readIntention(this, null); 194 return ca.addAll(index, c); 195 } 196 } 197 public Object get(int index) { 198 if (!jdoIsActive()) { 199 return accessor.get(index); 200 } else { 201 ListAccessor ca = (ListAccessor) getSpeedoHome().readIntention(this, null); 202 return ca.get(index); 203 } 204 } 205 public int indexOf(Object elem) { 206 if (!jdoIsActive()) { 207 return accessor.indexOf(elem); 208 } else { 209 ListAccessor ca = (ListAccessor) getSpeedoHome().readIntention(this, null); 210 return ca.indexOf(elem); 211 } 212 } 213 public Object remove(int index) { 214 if (!jdoIsActive()) { 215 return accessor.remove(index); 216 } else { 217 ListAccessor ca = (ListAccessor) getSpeedoHome().readIntention(this, null); 218 return ca.remove(index); 219 } 220 } 221 public Object set(int index, Object element) { 222 if (!jdoIsActive()) { 223 return accessor.set(index, element); 224 } else { 225 ListAccessor ca = (ListAccessor) getSpeedoHome().readIntention(this, null); 226 return ca.set(index, element); 227 } 228 } 229 public int lastIndexOf(Object o) { 230 if (!jdoIsActive()) { 231 return accessor.lastIndexOf(o); 232 } else { 233 ListAccessor ca = (ListAccessor) getSpeedoHome().readIntention(this, null); 234 return ca.lastIndexOf(o); 235 } 236 } 237 public ListIterator listIterator() { 238 if (!jdoIsActive()) { 239 return ((List ) accessor.collection).listIterator(); 240 } else { 241 ListAccessor la = (ListAccessor) getSpeedoHome().readIntention(this, null); 242 return la.listIterator(); 243 } 244 } 245 246 public ListIterator listIterator(int i) { 247 if (!jdoIsActive()) { 248 return ((List ) accessor.collection).listIterator(i); 249 } else { 250 ListAccessor la = (ListAccessor) getSpeedoHome().readIntention(this, null); 251 return la.listIterator(i); 252 } 253 } 254 255 public List subList(int i, int i1) { 256 if (!jdoIsActive()) { 257 return ((List ) accessor.collection).subList(i, i1); 258 } else { 259 ListAccessor la = (ListAccessor) getSpeedoHome().readIntention(this, null); 260 return la.subList(i, i1); 261 } 262 } 263 264 public Object createGenClass() { 265 return new Vector (); 266 } 267 268 public SpeedoAccessor createAccessor() { 269 return new ListAccessor(this); 270 } 271 } | Popular Tags |