1 Clazz.load(["java.util.AbstractList","$.List","$.RandomAccess"],"java.util.Vector",["java.lang.ArrayIndexOutOfBoundsException","$.IllegalArgumentException","$.IndexOutOfBoundsException","$.StringBuffer","java.lang.reflect.Array","java.util.Arrays","$.Collections","$.Enumeration","$.NoSuchElementException"],function(){
2 c$=Clazz.decorateAsClass(function(){
5 this.capacityIncrement=0;
6 Clazz.instantialize(this,arguments);
7 },java.util,"Vector",java.util.AbstractList,[java.util.List,java.util.RandomAccess,Cloneable,java.io.Serializable]);
8 Clazz.makeConstructor(c$,
12 Clazz.makeConstructor(c$,
14 this.construct(capacity,0);
16 Clazz.makeConstructor(c$,
17 function(capacity,capacityIncrement){
18 Clazz.superConstructor(this,java.util.Vector,[]);
21 this.elementData=this.newElementArray(capacity);
23 if(Clazz.instanceOf(e,NegativeArraySizeException)){
24 throw new IllegalArgumentException();
29 this.capacityIncrement=capacityIncrement;
31 Clazz.makeConstructor(c$,
33 this.construct(collection.size(),0);
34 var it=collection.iterator();
36 this.elementData[this.elementCount++]=it.next();
38 },"java.util.Collection");
39 Clazz.defineMethod(c$,"newElementArray",
41 return new Array(size);
42 },$fz.isPrivate=true,$fz),"~N");
43 Clazz.defineMethod(c$,"add",
44 function(location,object){
45 this.insertElementAt(object,location);
47 Clazz.defineMethod(c$,"add",
49 this.addElement(object);
52 Clazz.defineMethod(c$,"addAll",
53 function(location,collection){
54 if(0<=location&&location<=this.elementCount){
55 var size=collection.size();
58 }var required=size-(this.elementData.length-this.elementCount);
60 this.growBy(required);
61 }var count=this.elementCount-location;
63 System.arraycopy(this.elementData,location,this.elementData,location+size,count);
64 }var it=collection.iterator();
66 this.elementData[location++]=it.next();
68 this.elementCount+=size;
71 }throw new ArrayIndexOutOfBoundsException(location);
72 },"~N,java.util.Collection");
73 Clazz.defineMethod(c$,"addAll",
75 return this.addAll(this.elementCount,collection);
76 },"java.util.Collection");
77 Clazz.defineMethod(c$,"addElement",
79 if(this.elementCount==this.elementData.length){
81 }this.elementData[this.elementCount++]=object;
84 Clazz.defineMethod(c$,"capacity",
86 return this.elementData.length;
88 Clazz.overrideMethod(c$,"clear",
90 this.removeAllElements();
92 Clazz.defineMethod(c$,"clone",
95 var vector=Clazz.superCall(this,java.util.Vector,"clone",[]);
96 vector.elementData=this.elementData.clone();
99 if(Clazz.instanceOf(e,CloneNotSupportedException)){
106 Clazz.overrideMethod(c$,"contains",
108 return this.indexOf(object,0)!=-1;
110 Clazz.defineMethod(c$,"copyInto",
112 System.arraycopy(this.elementData,0,elements,0,this.elementCount);
114 Clazz.defineMethod(c$,"elementAt",
116 if(location<this.elementCount){
117 return this.elementData[location];
118 }throw new ArrayIndexOutOfBoundsException(location);
120 Clazz.defineMethod(c$,"elements",
122 return((Clazz.isClassDefined("java.util.Vector$1")?0:java.util.Vector.$Vector$1$()),Clazz.innerTypeInstance(java.util.Vector$1,this,null));
124 Clazz.defineMethod(c$,"ensureCapacity",
125 function(minimumCapacity){
126 if(this.elementData.length<minimumCapacity){
127 var next=(this.capacityIncrement<=0?this.elementData.length:this.capacityIncrement)+this.elementData.length;
128 this.grow(minimumCapacity>next?minimumCapacity:next);
130 Clazz.overrideMethod(c$,"equals",
134 }if(Clazz.instanceOf(object,java.util.List)){
136 if(list.size()!=this.size()){
139 var it=list.iterator();
141 var e1=this.elementData[index++];
143 if(!(e1==null?e2==null:e1.equals(e2))){
149 Clazz.defineMethod(c$,"firstElement",
151 if(this.elementCount>0){
152 return this.elementData[0];
153 }throw new java.util.NoSuchElementException();
155 Clazz.overrideMethod(c$,"get",
157 return this.elementAt(location);
159 Clazz.defineMethod(c$,"grow",
160 ($fz=function(newCapacity){
161 var newData=this.newElementArray(newCapacity);
162 System.arraycopy(this.elementData,0,newData,0,this.elementCount);
163 this.elementData=newData;
164 },$fz.isPrivate=true,$fz),"~N");
165 Clazz.defineMethod(c$,"growByOne",
168 if(this.capacityIncrement<=0){
169 if((adding=this.elementData.length)==0){
172 adding=this.capacityIncrement;
173 }var newData=this.newElementArray(this.elementData.length+adding);
174 System.arraycopy(this.elementData,0,newData,0,this.elementCount);
175 this.elementData=newData;
176 },$fz.isPrivate=true,$fz));
177 Clazz.defineMethod(c$,"growBy",
178 ($fz=function(required){
180 if(this.capacityIncrement<=0){
181 if((adding=this.elementData.length)==0){
183 }while(adding<required){
187 adding=(Math.floor(required/this.capacityIncrement))*this.capacityIncrement;
189 adding+=this.capacityIncrement;
190 }}var newData=this.newElementArray(this.elementData.length+adding);
191 System.arraycopy(this.elementData,0,newData,0,this.elementCount);
192 this.elementData=newData;
193 },$fz.isPrivate=true,$fz),"~N");
194 Clazz.overrideMethod(c$,"hashCode",
197 for(var i=0;i<this.elementCount;i++){
198 result=(31*result)+(this.elementData[i]==null?0:this.elementData[i].hashCode());
202 Clazz.defineMethod(c$,"indexOf",
204 return this.indexOf(object,0);
206 Clazz.defineMethod(c$,"indexOf",
207 function(object,location){
209 for(var i=location;i<this.elementCount;i++){
210 if(object.equals(this.elementData[i])){
214 for(var i=location;i<this.elementCount;i++){
215 if(this.elementData[i]==null){
220 Clazz.defineMethod(c$,"insertElementAt",
221 function(object,location){
222 if(0<=location&&location<=this.elementCount){
223 if(this.elementCount==this.elementData.length){
225 }var count=this.elementCount-location;
227 System.arraycopy(this.elementData,location,this.elementData,location+1,count);
228 }this.elementData[location]=object;
232 throw new ArrayIndexOutOfBoundsException(location);
234 Clazz.overrideMethod(c$,"isEmpty",
236 return this.elementCount==0;
238 Clazz.defineMethod(c$,"lastElement",
241 return this.elementData[this.elementCount-1];
243 if(Clazz.instanceOf(e,IndexOutOfBoundsException)){
244 throw new java.util.NoSuchElementException();
250 Clazz.defineMethod(c$,"lastIndexOf",
252 return this.lastIndexOf(object,this.elementCount-1);
254 Clazz.defineMethod(c$,"lastIndexOf",
255 function(object,location){
256 if(location<this.elementCount){
258 for(var i=location;i>=0;i--){
259 if(object.equals(this.elementData[i])){
263 for(var i=location;i>=0;i--){
264 if(this.elementData[i]==null){
268 }throw new ArrayIndexOutOfBoundsException(location);
270 Clazz.defineMethod(c$,"remove",
272 if(location<this.elementCount){
273 var result=this.elementData[location];
275 var size=this.elementCount-location;
277 System.arraycopy(this.elementData,location+1,this.elementData,location,size);
278 }this.elementData[this.elementCount]=null;
281 }throw new ArrayIndexOutOfBoundsException(location);
283 Clazz.defineMethod(c$,"remove",
285 return this.removeElement(object);
287 Clazz.defineMethod(c$,"removeAllElements",
289 java.util.Arrays.fill(this.elementData,0,this.elementCount,null);
293 Clazz.defineMethod(c$,"removeElement",
296 if((index=this.indexOf(object,0))==-1){
298 }this.removeElementAt(index);
301 Clazz.defineMethod(c$,"removeElementAt",
303 if(0<=location&&location<this.elementCount){
305 var size=this.elementCount-location;
307 System.arraycopy(this.elementData,location+1,this.elementData,location,size);
308 }this.elementData[this.elementCount]=null;
311 throw new ArrayIndexOutOfBoundsException(location);
313 Clazz.overrideMethod(c$,"removeRange",
315 if(start>=0&&start<=end&&end<=this.size()){
318 }if(end!=this.elementCount){
319 System.arraycopy(this.elementData,end,this.elementData,start,this.elementCount-end);
320 var newCount=this.elementCount-(end-start);
321 java.util.Arrays.fill(this.elementData,newCount,this.elementCount,null);
322 this.elementCount=newCount;
324 java.util.Arrays.fill(this.elementData,start,this.elementCount,null);
325 this.elementCount=start;
328 throw new IndexOutOfBoundsException();
330 Clazz.overrideMethod(c$,"set",
331 function(location,object){
332 if(location<this.elementCount){
333 var result=this.elementData[location];
334 this.elementData[location]=object;
336 }throw new ArrayIndexOutOfBoundsException(location);
338 Clazz.defineMethod(c$,"setElementAt",
339 function(object,location){
340 if(location<this.elementCount){
341 this.elementData[location]=object;
343 throw new ArrayIndexOutOfBoundsException(location);
345 Clazz.defineMethod(c$,"setSize",
347 if(length==this.elementCount){
349 }this.ensureCapacity(length);
350 if(this.elementCount>length){
351 java.util.Arrays.fill(this.elementData,length,this.elementCount,null);
352 }this.elementCount=length;
355 Clazz.overrideMethod(c$,"size",
357 return this.elementCount;
359 Clazz.overrideMethod(c$,"subList",
361 return new java.util.Collections.SynchronizedRandomAccessList(Clazz.superCall(this,java.util.Vector,"subList",[start,end]),this);
363 Clazz.defineMethod(c$,"toArray",
365 var result=new Array(this.elementCount);
366 System.arraycopy(this.elementData,0,result,0,this.elementCount);
369 Clazz.defineMethod(c$,"toArray",
371 if(this.elementCount>contents.length){
372 var ct=contents.getClass().getComponentType();
373 contents=java.lang.reflect.Array.newInstance(ct,this.elementCount);
374 }System.arraycopy(this.elementData,0,contents,0,this.elementCount);
375 if(this.elementCount<contents.length){
376 contents[this.elementCount]=null;
379 Clazz.overrideMethod(c$,"toString",
381 if(this.elementCount==0){
383 }var length=this.elementCount-1;
384 var buffer=new StringBuffer(this.size()*16);
386 for(var i=0;i<length;i++){
387 if(this.elementData[i]===this){
388 buffer.append("(this Collection)");
390 buffer.append(this.elementData[i]);
391 }buffer.append(", ");
393 if(this.elementData[length]===this){
394 buffer.append("(this Collection)");
396 buffer.append(this.elementData[length]);
398 return buffer.toString();
400 Clazz.defineMethod(c$,"trimToSize",
402 if(this.elementData.length!=this.elementCount){
403 this.grow(this.elementCount);
405 c$.$Vector$1$=function(){
407 c$=Clazz.decorateAsClass(function(){
408 Clazz.prepareCallback(this,arguments);
410 Clazz.instantialize(this,arguments);
411 },java.util,"Vector$1",null,java.util.Enumeration);
412 Clazz.overrideMethod(c$,"hasMoreElements",
414 return this.pos<this.b$["java.util.Vector"].elementCount;
416 Clazz.overrideMethod(c$,"nextElement",
419 if(this.pos<this.b$["java.util.Vector"].elementCount){
420 return this.b$["java.util.Vector"].elementData[this.pos++];
421 }}throw new java.util.NoSuchElementException();
425 Clazz.defineStatics(c$,