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