Merge branch 'master' of https://source.jalview.org/git/jalviewjs.git
[jalviewjs.git] / site / swingjs / j2s / java / util / ArrayList.js
index 0dc6497..de53421 100644 (file)
-Clazz.load(["java.util.AbstractList","$.List","$.RandomAccess"],"java.util.ArrayList",["java.lang.IllegalArgumentException","$.IndexOutOfBoundsException","java.lang.reflect.Array","java.util.Arrays"],function(){\r
-c$=Clazz.decorateAsClass(function(){\r
-this.firstIndex=0;\r
-this.lastIndex=0;\r
-this.array=null;\r
-Clazz.instantialize(this,arguments);\r
-},java.util,"ArrayList",java.util.AbstractList,[java.util.List,Cloneable,java.io.Serializable,java.util.RandomAccess]);\r
-\r
-Clazz.overrideConstructor(c$,\r
-function(){\r
-this.setup(0);\r
-});\r
-\r
-Clazz.defineMethod(c$, "setup",\r
-function(capacity){\r
-//Clazz.superConstructor(this,java.util.ArrayList,[]);\r
-this.firstIndex=this.lastIndex=0;\r
-try{\r
-this.array=this.newElementArray(capacity);\r
-}catch(e){\r
-if(Clazz.instanceOf(e,NegativeArraySizeException)){\r
-throw new IllegalArgumentException();\r
-}else{\r
-throw e;\r
-}\r
-}\r
-},"~N");\r
-/*\r
-Clazz.makeConstructor(c$,\r
-function(collection){\r
-Clazz.superConstructor(this,java.util.ArrayList,[]);\r
-var size=collection.size();\r
-this.firstIndex=this.lastIndex=0;\r
-this.array=this.newElementArray(size+(Math.floor(size/10)));\r
-this.addAll(collection);\r
-},"java.util.Collection");\r
-\r
-*/\r
-\r
-Clazz.defineMethod(c$,"newElementArray",\r
-($fz=function(size){\r
-return new Array(size);\r
-},$fz.isPrivate=true,$fz),"~N");\r
-\r
-Clazz.overrideMethod(c$,"add",\r
-function(location,object){\r
-\r
-if (arguments.length == 1) {\r
-       // coming from Java methods, e.g. Collections.list()\r
-       // location is actually the object\r
-       return this.add1(location);\r
-}\r
-var size=this.size();\r
-if(0<location&&location<size){\r
-if(this.firstIndex==0&&this.lastIndex==this.array.length){\r
-this.growForInsert(location,1);\r
-}else if((location<Math.floor(size/2)&&this.firstIndex>0)||this.lastIndex==this.array.length){\r
-System.arraycopy(this.array,this.firstIndex,this.array,--this.firstIndex,location);\r
-}else{\r
-var index=location+this.firstIndex;\r
-System.arraycopy(this.array,index,this.array,index+1,size-location);\r
-this.lastIndex++;\r
-}this.array[location+this.firstIndex]=object;\r
-}else if(location==0){\r
-if(this.firstIndex==0){\r
-this.growAtFront(1);\r
-}this.array[--this.firstIndex]=object;\r
-}else if(location==size){\r
-if(this.lastIndex==this.array.length){\r
-this.growAtEnd(1);\r
-}this.array[this.lastIndex++]=object;\r
-}else{\r
-throw new IndexOutOfBoundsException();\r
-}this.modCount++;\r
-},"~N,~O");\r
-\r
-Clazz.overrideMethod(c$,"add1",\r
-function(object){\r
-if(this.lastIndex==this.array.length){\r
-this.growAtEnd(1);\r
-}this.array[this.lastIndex++]=object;\r
-this.modCount++;\r
-return true;\r
-},"~O");\r
-\r
-/* BH disallow addAll(int,List)\r
- * \r
-Clazz.defineMethod(c$,"addAll",\r
-function(location,collection){\r
-var size=this.size();\r
-if(location<0||location>size){\r
-throw new IndexOutOfBoundsException();\r
-}var growSize=collection.size();\r
-if(0<location&&location<size){\r
-if(this.array.length-size<growSize){\r
-this.growForInsert(location,growSize);\r
-}else if((location<Math.floor(size/2)&&this.firstIndex>0)||this.lastIndex>this.array.length-growSize){\r
-var newFirst=this.firstIndex-growSize;\r
-if(newFirst<0){\r
-var index=location+this.firstIndex;\r
-System.arraycopy(this.array,index,this.array,index-newFirst,size-location);\r
-this.lastIndex-=newFirst;\r
-newFirst=0;\r
-}System.arraycopy(this.array,this.firstIndex,this.array,newFirst,location);\r
-this.firstIndex=newFirst;\r
-}else{\r
-var index=location+this.firstIndex;\r
-System.arraycopy(this.array,index,this.array,index+growSize,size-location);\r
-this.lastIndex+=growSize;\r
-}}else if(location==0){\r
-this.growAtFront(growSize);\r
-this.firstIndex-=growSize;\r
-}else if(location==size){\r
-if(this.lastIndex>this.array.length-growSize){\r
-this.growAtEnd(growSize);\r
-}this.lastIndex+=growSize;\r
-}if(growSize>0){\r
-var it=collection.iterator();\r
-var index=location+this.firstIndex;\r
-var end=index+growSize;\r
-while(index<end){\r
-this.array[index++]=it.next();\r
-}\r
-this.modCount++;\r
-return true;\r
-}return false;\r
-},"~N,java.util.Collection");\r
-\r
- */\r
-\r
-Clazz.overrideMethod(c$,"addAll",\r
-function(collection){\r
-var growSize=collection.size();\r
-if(growSize>0){\r
-       if(this.lastIndex>this.array.length-growSize){\r
-               this.growAtEnd(growSize);\r
-}\r
-var it=collection.iterator();\r
-var end=this.lastIndex+growSize;\r
-while(this.lastIndex<end){\r
-       this.array[this.lastIndex++]=it.next();\r
-}\r
-this.modCount++;\r
-return true;\r
-}return false;\r
-},"java.util.Collection");\r
-\r
-Clazz.overrideMethod(c$,"clear",\r
-function(){\r
-if(this.firstIndex!=this.lastIndex){\r
-this.fill(this.firstIndex,this.lastIndex);\r
-this.firstIndex=this.lastIndex=0;\r
-this.modCount++;\r
-}});\r
-\r
-Clazz.defineMethod(c$,"fill", function(i1, i2) { // BH\r
-for (var i = i2; --i >= i1;)\r
-this.array[i] = null;\r
-},"~N,~N");\r
-\r
-Clazz.defineMethod(c$,"clone",\r
-function(){\r
-try{\r
-var newList=Clazz.superCall(this,java.util.ArrayList,"clone",[]);\r
-newList.array=this.array.clone();\r
-return newList;\r
-}catch(e){\r
-if(Clazz.instanceOf(e,CloneNotSupportedException)){\r
-return null;\r
-}else{\r
-throw e;\r
-}\r
-}\r
-});\r
-Clazz.overrideMethod(c$,"contains",\r
-function(object){\r
-if(object!=null){\r
-for(var i=this.firstIndex;i<this.lastIndex;i++){\r
-if(object.equals(this.array[i])){\r
-return true;\r
-}}\r
-}else{\r
-for(var i=this.firstIndex;i<this.lastIndex;i++){\r
-if(this.array[i]==null){\r
-return true;\r
-}}\r
-}return false;\r
-},"~O");\r
-Clazz.defineMethod(c$,"ensureCapacity",\r
-function(minimumCapacity){\r
-if(this.array.length<minimumCapacity){\r
-if(this.firstIndex>0){\r
-this.growAtFront(minimumCapacity-this.array.length);\r
-}else{\r
-this.growAtEnd(minimumCapacity-this.array.length);\r
-}}},"~N");\r
-Clazz.overrideMethod(c$,"get",\r
-function(location){\r
-if(0<=location&&location<this.size()){\r
-return this.array[this.firstIndex+location];\r
-}throw new IndexOutOfBoundsException();\r
-},"~N");\r
-\r
-\r
-Clazz.defineMethod(c$,"growAtEnd",\r
-($fz=function(required){\r
-var size=this.size();\r
-if(this.firstIndex>=required-(this.array.length-this.lastIndex)){\r
-       var newLast=this.lastIndex-this.firstIndex;\r
-       if(size>0){\r
-               System.arraycopy(this.array,this.firstIndex,this.array,0,size);\r
-               var start=newLast<this.firstIndex?this.firstIndex:newLast;\r
-               this.fill(start,this.array.length);\r
-       }\r
-       this.firstIndex=0;\r
-       this.lastIndex=newLast;\r
-}else{\r
-       var increment=Math.floor(size/2);\r
-       if(required>increment){\r
-               increment=required;\r
-       }\r
-       if(increment<12){\r
-               increment=12;\r
-       }\r
-       var newArray=this.newElementArray(size+increment);\r
-       if(size>0){\r
-               System.arraycopy(this.array,this.firstIndex,newArray,this.firstIndex,size);\r
-       }\r
-       this.array=newArray;\r
-}\r
-\r
-},$fz.isPrivate=true,$fz),"~N");\r
-Clazz.defineMethod(c$,"growAtFront",\r
-($fz=function(required){\r
-var size=this.size();\r
-if(this.array.length-this.lastIndex>=required){\r
-var newFirst=this.array.length-size;\r
-if(size>0){\r
-System.arraycopy(this.array,this.firstIndex,this.array,newFirst,size);\r
-var length=this.firstIndex+size>newFirst?newFirst:this.firstIndex+size;\r
-this.fill(this.firstIndex,length);\r
-}this.firstIndex=newFirst;\r
-this.lastIndex=this.array.length;\r
-}else{\r
-var increment=Math.floor(size/2);\r
-if(required>increment){\r
-increment=required;\r
-}if(increment<12){\r
-increment=12;\r
-}var newArray=this.newElementArray(size+increment);\r
-if(size>0){\r
-System.arraycopy(this.array,this.firstIndex,newArray,newArray.length-size,size);\r
-}this.firstIndex=newArray.length-size;\r
-this.lastIndex=newArray.length;\r
-this.array=newArray;\r
-}},$fz.isPrivate=true,$fz),"~N");\r
-Clazz.defineMethod(c$,"growForInsert",\r
-($fz=function(location,required){\r
-var size=this.size();\r
-var increment=Math.floor(size/2);\r
-if(required>increment){\r
-increment=required;\r
-}if(increment<12){\r
-increment=12;\r
-}var newArray=this.newElementArray(size+increment);\r
-if(location<Math.floor(size/2)){\r
-var newFirst=newArray.length-(size+required);\r
-System.arraycopy(this.array,location,newArray,location+increment,size-location);\r
-System.arraycopy(this.array,this.firstIndex,newArray,newFirst,location);\r
-this.firstIndex=newFirst;\r
-this.lastIndex=newArray.length;\r
-}else{\r
-System.arraycopy(this.array,this.firstIndex,newArray,0,location);\r
-System.arraycopy(this.array,location,newArray,location+required,size-location);\r
-this.firstIndex=0;\r
-this.lastIndex+=required;\r
-}this.array=newArray;\r
-},$fz.isPrivate=true,$fz),"~N,~N");\r
-Clazz.overrideMethod(c$,"indexOf",\r
-function(object){\r
-if(object!=null){\r
-for(var i=this.firstIndex;i<this.lastIndex;i++){\r
-if(object.equals(this.array[i])){\r
-return i-this.firstIndex;\r
-}}\r
-}else{\r
-for(var i=this.firstIndex;i<this.lastIndex;i++){\r
-if(this.array[i]==null){\r
-return i-this.firstIndex;\r
-}}\r
-}return-1;\r
-},"~O");\r
-Clazz.overrideMethod(c$,"isEmpty",\r
-function(){\r
-return this.lastIndex==this.firstIndex;\r
-});\r
-Clazz.overrideMethod(c$,"lastIndexOf",\r
-function(object){\r
-if(object!=null){\r
-for(var i=this.lastIndex-1;i>=this.firstIndex;i--){\r
-if(object.equals(this.array[i])){\r
-return i-this.firstIndex;\r
-}}\r
-}else{\r
-for(var i=this.lastIndex-1;i>=this.firstIndex;i--){\r
-if(this.array[i]==null){\r
-return i-this.firstIndex;\r
-}}\r
-}return-1;\r
-},"~O");\r
-Clazz.overrideMethod(c$,"remove",\r
-function(location){\r
-var result;\r
-var size=this.size();\r
-if(0<=location&&location<size){\r
-if(location==size-1){\r
-result=this.array[--this.lastIndex];\r
-this.array[this.lastIndex]=null;\r
-}else if(location==0){\r
-result=this.array[this.firstIndex];\r
-this.array[this.firstIndex++]=null;\r
-}else{\r
-var elementIndex=this.firstIndex+location;\r
-result=this.array[elementIndex];\r
-if(location<Math.floor(size/2)){\r
-System.arraycopy(this.array,this.firstIndex,this.array,this.firstIndex+1,location);\r
-this.array[this.firstIndex++]=null;\r
-}else{\r
-System.arraycopy(this.array,elementIndex+1,this.array,elementIndex,size-location-1);\r
-this.array[--this.lastIndex]=null;\r
-}}}else{\r
-throw new IndexOutOfBoundsException();\r
-}this.modCount++;\r
-return result;\r
-},"~N"); \r
-\r
-Clazz.defineMethod(c$, "removeObject", function(o) {\r
-       var i = this.indexOf(o);\r
-       if (i < 0)return null;\r
-       return this.remove(i);\r
-}, "~O");\r
-\r
-Clazz.overrideMethod(c$,"removeRange",\r
-function(start,end){\r
-if(start>=0&&start<=end&&end<=this.size()){\r
-if(start==end){\r
-return;\r
-}var size=this.size();\r
-if(end==size){\r
-       this.fill(this.firstIndex+start,this.lastIndex);\r
-this.lastIndex=this.firstIndex+start;\r
-}else if(start==0){\r
-       this.fill(this.firstIndex,this.firstIndex+end);\r
-this.firstIndex+=end;\r
-}else{\r
-System.arraycopy(this.array,this.firstIndex+end,this.array,this.firstIndex+start,size-end);\r
-var newLast=this.lastIndex+start-end;\r
-this.fill(newLast,this.lastIndex);\r
-this.lastIndex=newLast;\r
-}this.modCount++;\r
-}else{\r
-throw new IndexOutOfBoundsException();\r
-}},"~N,~N");\r
-Clazz.overrideMethod(c$,"set",\r
-function(location,object){\r
-if(0<=location&&location<this.size()){\r
-var result=this.array[this.firstIndex+location];\r
-this.array[this.firstIndex+location]=object;\r
-return result;\r
-}throw new IndexOutOfBoundsException();\r
-},"~N,~O");\r
-Clazz.overrideMethod(c$,"size",\r
-function(){\r
-return this.lastIndex-this.firstIndex;\r
-});\r
-/*\r
-Clazz.defineMethod(c$,"toArray",\r
-function(){\r
-var size=this.size();\r
-var result=new Array(size);\r
-System.arraycopy(this.array,this.firstIndex,result,0,size);\r
-return result;\r
-});\r
-*/\r
-\r
-Clazz.overrideMethod(c$,"toArray",\r
-function(contents){\r
-var size=this.size();\r
-if(!contents || size>contents.length)\r
-       contents= new Array(size);\r
-System.arraycopy(this.array,this.firstIndex,contents,0,size);\r
-if(size<contents.length){\r
-contents[size]=null;\r
-}return contents;\r
-},"~O");\r
-Clazz.defineMethod(c$,"trimToSize",\r
-function(){\r
-var size=this.size();\r
-var newArray=this.newElementArray(size);\r
-System.arraycopy(this.array,this.firstIndex,newArray,0,size);\r
-this.array=newArray;\r
-this.firstIndex=0;\r
-this.lastIndex=this.array.length;\r
-});\r
-});\r
+Clazz.load(["java.util.AbstractList","$.List","$.RandomAccess"],"java.util.ArrayList",["java.lang.IllegalArgumentException","$.IndexOutOfBoundsException","java.lang.reflect.Array","java.util.Arrays"],function(){
+c$=Clazz.decorateAsClass(function(){
+this.firstIndex=0;
+this.lastIndex=0;
+this.array=null;
+Clazz.instantialize(this,arguments);
+},java.util,"ArrayList",java.util.AbstractList,[java.util.List,Cloneable,java.io.Serializable,java.util.RandomAccess]);
+
+Clazz.overrideConstructor(c$,
+function(){
+this.setup(0);
+});
+
+Clazz.defineMethod(c$, "setup",
+function(capacity){
+//Clazz.superConstructor(this,java.util.ArrayList,[]);
+this.firstIndex=this.lastIndex=0;
+try{
+this.array=this.newElementArray(capacity);
+}catch(e){
+if(Clazz.instanceOf(e,NegativeArraySizeException)){
+throw new IllegalArgumentException();
+}else{
+throw e;
+}
+}
+},"~N");
+/*
+Clazz.makeConstructor(c$,
+function(collection){
+Clazz.superConstructor(this,java.util.ArrayList,[]);
+var size=collection.size();
+this.firstIndex=this.lastIndex=0;
+this.array=this.newElementArray(size+(Math.floor(size/10)));
+this.addAll(collection);
+},"java.util.Collection");
+
+*/
+
+Clazz.defineMethod(c$,"newElementArray",
+($fz=function(size){
+return new Array(size);
+},$fz.isPrivate=true,$fz),"~N");
+
+Clazz.overrideMethod(c$,"add",
+function(location,object){
+
+if (arguments.length == 1) {
+       // coming from Java methods, e.g. Collections.list()
+       // location is actually the object
+       return this.add1(location);
+}
+var size=this.size();
+if(0<location&&location<size){
+if(this.firstIndex==0&&this.lastIndex==this.array.length){
+this.growForInsert(location,1);
+}else if((location<Math.floor(size/2)&&this.firstIndex>0)||this.lastIndex==this.array.length){
+System.arraycopy(this.array,this.firstIndex,this.array,--this.firstIndex,location);
+}else{
+var index=location+this.firstIndex;
+System.arraycopy(this.array,index,this.array,index+1,size-location);
+this.lastIndex++;
+}this.array[location+this.firstIndex]=object;
+}else if(location==0){
+if(this.firstIndex==0){
+this.growAtFront(1);
+}this.array[--this.firstIndex]=object;
+}else if(location==size){
+if(this.lastIndex==this.array.length){
+this.growAtEnd(1);
+}this.array[this.lastIndex++]=object;
+}else{
+throw new IndexOutOfBoundsException();
+}this.modCount++;
+},"~N,~O");
+
+Clazz.overrideMethod(c$,"add1",
+function(object){
+if(this.lastIndex==this.array.length){
+this.growAtEnd(1);
+}this.array[this.lastIndex++]=object;
+this.modCount++;
+return true;
+},"~O");
+
+/* BH disallow addAll(int,List)
+ * 
+Clazz.defineMethod(c$,"addAll",
+function(location,collection){
+var size=this.size();
+if(location<0||location>size){
+throw new IndexOutOfBoundsException();
+}var growSize=collection.size();
+if(0<location&&location<size){
+if(this.array.length-size<growSize){
+this.growForInsert(location,growSize);
+}else if((location<Math.floor(size/2)&&this.firstIndex>0)||this.lastIndex>this.array.length-growSize){
+var newFirst=this.firstIndex-growSize;
+if(newFirst<0){
+var index=location+this.firstIndex;
+System.arraycopy(this.array,index,this.array,index-newFirst,size-location);
+this.lastIndex-=newFirst;
+newFirst=0;
+}System.arraycopy(this.array,this.firstIndex,this.array,newFirst,location);
+this.firstIndex=newFirst;
+}else{
+var index=location+this.firstIndex;
+System.arraycopy(this.array,index,this.array,index+growSize,size-location);
+this.lastIndex+=growSize;
+}}else if(location==0){
+this.growAtFront(growSize);
+this.firstIndex-=growSize;
+}else if(location==size){
+if(this.lastIndex>this.array.length-growSize){
+this.growAtEnd(growSize);
+}this.lastIndex+=growSize;
+}if(growSize>0){
+var it=collection.iterator();
+var index=location+this.firstIndex;
+var end=index+growSize;
+while(index<end){
+this.array[index++]=it.next();
+}
+this.modCount++;
+return true;
+}return false;
+},"~N,java.util.Collection");
+
+ */
+
+Clazz.overrideMethod(c$,"addAll",
+function(collection){
+var growSize=collection.size();
+if(growSize>0){
+       if(this.lastIndex>this.array.length-growSize){
+               this.growAtEnd(growSize);
+}
+var it=collection.iterator();
+var end=this.lastIndex+growSize;
+while(this.lastIndex<end){
+       this.array[this.lastIndex++]=it.next();
+}
+this.modCount++;
+return true;
+}return false;
+},"java.util.Collection");
+
+Clazz.overrideMethod(c$,"clear",
+function(){
+if(this.firstIndex!=this.lastIndex){
+this.fill(this.firstIndex,this.lastIndex);
+this.firstIndex=this.lastIndex=0;
+this.modCount++;
+}});
+
+Clazz.defineMethod(c$,"fill", function(i1, i2) { // BH
+for (var i = i2; --i >= i1;)
+this.array[i] = null;
+},"~N,~N");
+
+Clazz.defineMethod(c$,"clone",
+function(){
+try{
+var newList=Clazz.superCall(this,java.util.ArrayList,"clone",[]);
+newList.array=this.array.clone();
+return newList;
+}catch(e){
+if(Clazz.instanceOf(e,CloneNotSupportedException)){
+return null;
+}else{
+throw e;
+}
+}
+});
+Clazz.overrideMethod(c$,"contains",
+function(object){
+if(object!=null){
+for(var i=this.firstIndex;i<this.lastIndex;i++){
+if(object.equals(this.array[i])){
+return true;
+}}
+}else{
+for(var i=this.firstIndex;i<this.lastIndex;i++){
+if(this.array[i]==null){
+return true;
+}}
+}return false;
+},"~O");
+Clazz.defineMethod(c$,"ensureCapacity",
+function(minimumCapacity){
+if(this.array.length<minimumCapacity){
+if(this.firstIndex>0){
+this.growAtFront(minimumCapacity-this.array.length);
+}else{
+this.growAtEnd(minimumCapacity-this.array.length);
+}}},"~N");
+Clazz.overrideMethod(c$,"get",
+function(location){
+if(0<=location&&location<this.size()){
+return this.array[this.firstIndex+location];
+}throw new IndexOutOfBoundsException();
+},"~N");
+
+
+Clazz.defineMethod(c$,"growAtEnd",
+($fz=function(required){
+var size=this.size();
+if(this.firstIndex>=required-(this.array.length-this.lastIndex)){
+       var newLast=this.lastIndex-this.firstIndex;
+       if(size>0){
+               System.arraycopy(this.array,this.firstIndex,this.array,0,size);
+               var start=newLast<this.firstIndex?this.firstIndex:newLast;
+               this.fill(start,this.array.length);
+       }
+       this.firstIndex=0;
+       this.lastIndex=newLast;
+}else{
+       var increment=Math.floor(size/2);
+       if(required>increment){
+               increment=required;
+       }
+       if(increment<12){
+               increment=12;
+       }
+       var newArray=this.newElementArray(size+increment);
+       if(size>0){
+               System.arraycopy(this.array,this.firstIndex,newArray,this.firstIndex,size);
+       }
+       this.array=newArray;
+}
+
+},$fz.isPrivate=true,$fz),"~N");
+Clazz.defineMethod(c$,"growAtFront",
+($fz=function(required){
+var size=this.size();
+if(this.array.length-this.lastIndex>=required){
+var newFirst=this.array.length-size;
+if(size>0){
+System.arraycopy(this.array,this.firstIndex,this.array,newFirst,size);
+var length=this.firstIndex+size>newFirst?newFirst:this.firstIndex+size;
+this.fill(this.firstIndex,length);
+}this.firstIndex=newFirst;
+this.lastIndex=this.array.length;
+}else{
+var increment=Math.floor(size/2);
+if(required>increment){
+increment=required;
+}if(increment<12){
+increment=12;
+}var newArray=this.newElementArray(size+increment);
+if(size>0){
+System.arraycopy(this.array,this.firstIndex,newArray,newArray.length-size,size);
+}this.firstIndex=newArray.length-size;
+this.lastIndex=newArray.length;
+this.array=newArray;
+}},$fz.isPrivate=true,$fz),"~N");
+Clazz.defineMethod(c$,"growForInsert",
+($fz=function(location,required){
+var size=this.size();
+var increment=Math.floor(size/2);
+if(required>increment){
+increment=required;
+}if(increment<12){
+increment=12;
+}var newArray=this.newElementArray(size+increment);
+if(location<Math.floor(size/2)){
+var newFirst=newArray.length-(size+required);
+System.arraycopy(this.array,location,newArray,location+increment,size-location);
+System.arraycopy(this.array,this.firstIndex,newArray,newFirst,location);
+this.firstIndex=newFirst;
+this.lastIndex=newArray.length;
+}else{
+System.arraycopy(this.array,this.firstIndex,newArray,0,location);
+System.arraycopy(this.array,location,newArray,location+required,size-location);
+this.firstIndex=0;
+this.lastIndex+=required;
+}this.array=newArray;
+},$fz.isPrivate=true,$fz),"~N,~N");
+Clazz.overrideMethod(c$,"indexOf",
+function(object){
+if(object!=null){
+for(var i=this.firstIndex;i<this.lastIndex;i++){
+if(object.equals(this.array[i])){
+return i-this.firstIndex;
+}}
+}else{
+for(var i=this.firstIndex;i<this.lastIndex;i++){
+if(this.array[i]==null){
+return i-this.firstIndex;
+}}
+}return-1;
+},"~O");
+Clazz.overrideMethod(c$,"isEmpty",
+function(){
+return this.lastIndex==this.firstIndex;
+});
+Clazz.overrideMethod(c$,"lastIndexOf",
+function(object){
+if(object!=null){
+for(var i=this.lastIndex-1;i>=this.firstIndex;i--){
+if(object.equals(this.array[i])){
+return i-this.firstIndex;
+}}
+}else{
+for(var i=this.lastIndex-1;i>=this.firstIndex;i--){
+if(this.array[i]==null){
+return i-this.firstIndex;
+}}
+}return-1;
+},"~O");
+Clazz.overrideMethod(c$,"remove",
+function(location){
+var result;
+var size=this.size();
+if(0<=location&&location<size){
+if(location==size-1){
+result=this.array[--this.lastIndex];
+this.array[this.lastIndex]=null;
+}else if(location==0){
+result=this.array[this.firstIndex];
+this.array[this.firstIndex++]=null;
+}else{
+var elementIndex=this.firstIndex+location;
+result=this.array[elementIndex];
+if(location<Math.floor(size/2)){
+System.arraycopy(this.array,this.firstIndex,this.array,this.firstIndex+1,location);
+this.array[this.firstIndex++]=null;
+}else{
+System.arraycopy(this.array,elementIndex+1,this.array,elementIndex,size-location-1);
+this.array[--this.lastIndex]=null;
+}}}else{
+throw new IndexOutOfBoundsException();
+}this.modCount++;
+return result;
+},"~N"); 
+
+Clazz.defineMethod(c$, "removeObject", function(o) {
+       var i = this.indexOf(o);
+       if (i < 0)return null;
+       return this.remove(i);
+}, "~O");
+
+Clazz.overrideMethod(c$,"removeRange",
+function(start,end){
+if(start>=0&&start<=end&&end<=this.size()){
+if(start==end){
+return;
+}var size=this.size();
+if(end==size){
+       this.fill(this.firstIndex+start,this.lastIndex);
+this.lastIndex=this.firstIndex+start;
+}else if(start==0){
+       this.fill(this.firstIndex,this.firstIndex+end);
+this.firstIndex+=end;
+}else{
+System.arraycopy(this.array,this.firstIndex+end,this.array,this.firstIndex+start,size-end);
+var newLast=this.lastIndex+start-end;
+this.fill(newLast,this.lastIndex);
+this.lastIndex=newLast;
+}this.modCount++;
+}else{
+throw new IndexOutOfBoundsException();
+}},"~N,~N");
+Clazz.overrideMethod(c$,"set",
+function(location,object){
+if(0<=location&&location<this.size()){
+var result=this.array[this.firstIndex+location];
+this.array[this.firstIndex+location]=object;
+return result;
+}throw new IndexOutOfBoundsException();
+},"~N,~O");
+Clazz.overrideMethod(c$,"size",
+function(){
+return this.lastIndex-this.firstIndex;
+});
+/*
+Clazz.defineMethod(c$,"toArray",
+function(){
+var size=this.size();
+var result=new Array(size);
+System.arraycopy(this.array,this.firstIndex,result,0,size);
+return result;
+});
+*/
+
+Clazz.overrideMethod(c$,"toArray",
+function(contents){
+var size=this.size();
+if(!contents || size>contents.length)
+       contents= new Array(size);
+System.arraycopy(this.array,this.firstIndex,contents,0,size);
+if(size<contents.length){
+contents[size]=null;
+}return contents;
+},"~O");
+Clazz.defineMethod(c$,"trimToSize",
+function(){
+var size=this.size();
+var newArray=this.newElementArray(size);
+System.arraycopy(this.array,this.firstIndex,newArray,0,size);
+this.array=newArray;
+this.firstIndex=0;
+this.lastIndex=this.array.length;
+});
+});