home *** CD-ROM | disk | FTP | other *** search
- package java.util;
-
- import java.io.Serializable;
- import java.lang.reflect.Array;
-
- public class Vector extends AbstractList implements List, Cloneable, Serializable {
- protected Object[] elementData;
- protected int elementCount;
- protected int capacityIncrement;
- private static final long serialVersionUID = -2767605614048989439L;
-
- public Vector(int var1, int var2) {
- if (var1 < 0) {
- throw new IllegalArgumentException("Illegal Capacity: " + var1);
- } else {
- this.elementData = new Object[var1];
- this.capacityIncrement = var2;
- }
- }
-
- public Vector(int var1) {
- this(var1, 0);
- }
-
- public Vector() {
- this(10);
- }
-
- public Vector(Collection var1) {
- this.elementCount = var1.size();
- this.elementData = new Object[this.elementCount * 110 / 100];
- var1.toArray(this.elementData);
- }
-
- public synchronized void copyInto(Object[] var1) {
- System.arraycopy(this.elementData, 0, var1, 0, this.elementCount);
- }
-
- public synchronized void trimToSize() {
- ++super.modCount;
- int var1 = this.elementData.length;
- if (this.elementCount < var1) {
- Object[] var2 = this.elementData;
- this.elementData = new Object[this.elementCount];
- System.arraycopy(var2, 0, this.elementData, 0, this.elementCount);
- }
-
- }
-
- public synchronized void ensureCapacity(int var1) {
- ++super.modCount;
- this.ensureCapacityHelper(var1);
- }
-
- private void ensureCapacityHelper(int var1) {
- int var2 = this.elementData.length;
- if (var1 > var2) {
- Object[] var3 = this.elementData;
- int var4 = this.capacityIncrement > 0 ? var2 + this.capacityIncrement : var2 * 2;
- if (var4 < var1) {
- var4 = var1;
- }
-
- this.elementData = new Object[var4];
- System.arraycopy(var3, 0, this.elementData, 0, this.elementCount);
- }
-
- }
-
- public synchronized void setSize(int var1) {
- ++super.modCount;
- if (var1 > this.elementCount) {
- this.ensureCapacityHelper(var1);
- } else {
- for(int var2 = var1; var2 < this.elementCount; ++var2) {
- this.elementData[var2] = null;
- }
- }
-
- this.elementCount = var1;
- }
-
- public int capacity() {
- return this.elementData.length;
- }
-
- public int size() {
- return this.elementCount;
- }
-
- public boolean isEmpty() {
- return this.elementCount == 0;
- }
-
- public Enumeration elements() {
- return new 1(this);
- }
-
- public boolean contains(Object var1) {
- return this.indexOf(var1, 0) >= 0;
- }
-
- public int indexOf(Object var1) {
- return this.indexOf(var1, 0);
- }
-
- public synchronized int indexOf(Object var1, int var2) {
- if (var1 == null) {
- for(int var3 = var2; var3 < this.elementCount; ++var3) {
- if (this.elementData[var3] == null) {
- return var3;
- }
- }
- } else {
- for(int var4 = var2; var4 < this.elementCount; ++var4) {
- if (var1.equals(this.elementData[var4])) {
- return var4;
- }
- }
- }
-
- return -1;
- }
-
- public int lastIndexOf(Object var1) {
- return this.lastIndexOf(var1, this.elementCount - 1);
- }
-
- public synchronized int lastIndexOf(Object var1, int var2) {
- if (var2 >= this.elementCount) {
- throw new IndexOutOfBoundsException(var2 + " >= " + this.elementCount);
- } else {
- if (var1 == null) {
- for(int var3 = var2; var3 >= 0; --var3) {
- if (this.elementData[var3] == null) {
- return var3;
- }
- }
- } else {
- for(int var4 = var2; var4 >= 0; --var4) {
- if (var1.equals(this.elementData[var4])) {
- return var4;
- }
- }
- }
-
- return -1;
- }
- }
-
- public synchronized Object elementAt(int var1) {
- if (var1 >= this.elementCount) {
- throw new ArrayIndexOutOfBoundsException(var1 + " >= " + this.elementCount);
- } else {
- try {
- return this.elementData[var1];
- } catch (ArrayIndexOutOfBoundsException var3) {
- throw new ArrayIndexOutOfBoundsException(var1 + " < 0");
- }
- }
- }
-
- public synchronized Object firstElement() {
- if (this.elementCount == 0) {
- throw new NoSuchElementException();
- } else {
- return this.elementData[0];
- }
- }
-
- public synchronized Object lastElement() {
- if (this.elementCount == 0) {
- throw new NoSuchElementException();
- } else {
- return this.elementData[this.elementCount - 1];
- }
- }
-
- public synchronized void setElementAt(Object var1, int var2) {
- if (var2 >= this.elementCount) {
- throw new ArrayIndexOutOfBoundsException(var2 + " >= " + this.elementCount);
- } else {
- this.elementData[var2] = var1;
- }
- }
-
- public synchronized void removeElementAt(int var1) {
- ++super.modCount;
- if (var1 >= this.elementCount) {
- throw new ArrayIndexOutOfBoundsException(var1 + " >= " + this.elementCount);
- } else if (var1 < 0) {
- throw new ArrayIndexOutOfBoundsException(var1);
- } else {
- int var2 = this.elementCount - var1 - 1;
- if (var2 > 0) {
- System.arraycopy(this.elementData, var1 + 1, this.elementData, var1, var2);
- }
-
- --this.elementCount;
- this.elementData[this.elementCount] = null;
- }
- }
-
- public synchronized void insertElementAt(Object var1, int var2) {
- ++super.modCount;
- if (var2 >= this.elementCount + 1) {
- throw new ArrayIndexOutOfBoundsException(var2 + " > " + this.elementCount);
- } else {
- this.ensureCapacityHelper(this.elementCount + 1);
- System.arraycopy(this.elementData, var2, this.elementData, var2 + 1, this.elementCount - var2);
- this.elementData[var2] = var1;
- ++this.elementCount;
- }
- }
-
- public synchronized void addElement(Object var1) {
- ++super.modCount;
- this.ensureCapacityHelper(this.elementCount + 1);
- this.elementData[this.elementCount++] = var1;
- }
-
- public synchronized boolean removeElement(Object var1) {
- ++super.modCount;
- int var2 = this.indexOf(var1);
- if (var2 >= 0) {
- this.removeElementAt(var2);
- return true;
- } else {
- return false;
- }
- }
-
- public synchronized void removeAllElements() {
- for(int var1 = 0; var1 < this.elementCount; ++var1) {
- this.elementData[var1] = null;
- }
-
- this.elementCount = 0;
- }
-
- public synchronized Object clone() {
- try {
- Vector var1 = (Vector)super.clone();
- var1.elementData = new Object[this.elementCount];
- System.arraycopy(this.elementData, 0, var1.elementData, 0, this.elementCount);
- var1.modCount = 0;
- return var1;
- } catch (CloneNotSupportedException var2) {
- throw new InternalError();
- }
- }
-
- public synchronized Object[] toArray() {
- Object[] var1 = new Object[this.elementCount];
- System.arraycopy(this.elementData, 0, var1, 0, this.elementCount);
- return var1;
- }
-
- public synchronized Object[] toArray(Object[] var1) {
- if (var1.length < this.elementCount) {
- var1 = Array.newInstance(var1.getClass().getComponentType(), this.elementCount);
- }
-
- System.arraycopy(this.elementData, 0, var1, 0, this.elementCount);
- if (var1.length > this.elementCount) {
- var1[this.elementCount] = null;
- }
-
- return var1;
- }
-
- public synchronized Object get(int var1) {
- if (var1 >= this.elementCount) {
- throw new ArrayIndexOutOfBoundsException(var1);
- } else {
- return this.elementData[var1];
- }
- }
-
- public synchronized Object set(int var1, Object var2) {
- if (var1 >= this.elementCount) {
- throw new ArrayIndexOutOfBoundsException(var1);
- } else {
- Object var3 = this.elementData[var1];
- this.elementData[var1] = var2;
- return var3;
- }
- }
-
- public synchronized boolean add(Object var1) {
- ++super.modCount;
- this.ensureCapacityHelper(this.elementCount + 1);
- this.elementData[this.elementCount++] = var1;
- return true;
- }
-
- public boolean remove(Object var1) {
- return this.removeElement(var1);
- }
-
- public void add(int var1, Object var2) {
- this.insertElementAt(var2, var1);
- }
-
- public synchronized Object remove(int var1) {
- ++super.modCount;
- if (var1 >= this.elementCount) {
- throw new ArrayIndexOutOfBoundsException(var1);
- } else {
- Object var2 = this.elementData[var1];
- int var3 = this.elementCount - var1 - 1;
- if (var3 > 0) {
- System.arraycopy(this.elementData, var1 + 1, this.elementData, var1, var3);
- }
-
- this.elementData[--this.elementCount] = null;
- return var2;
- }
- }
-
- public void clear() {
- this.removeAllElements();
- }
-
- public synchronized boolean containsAll(Collection var1) {
- return super.containsAll(var1);
- }
-
- public synchronized boolean addAll(Collection var1) {
- ++super.modCount;
- int var2 = var1.size();
- this.ensureCapacityHelper(this.elementCount + var2);
- Iterator var3 = var1.iterator();
-
- for(int var4 = 0; var4 < var2; ++var4) {
- this.elementData[this.elementCount++] = var3.next();
- }
-
- return var2 != 0;
- }
-
- public synchronized boolean removeAll(Collection var1) {
- return super.removeAll(var1);
- }
-
- public synchronized boolean retainAll(Collection var1) {
- return super.retainAll(var1);
- }
-
- public synchronized boolean addAll(int var1, Collection var2) {
- ++super.modCount;
- if (var1 >= 0 && var1 <= this.elementCount) {
- int var3 = var2.size();
- this.ensureCapacityHelper(this.elementCount + var3);
- int var4 = this.elementCount - var1;
- if (var4 > 0) {
- System.arraycopy(this.elementData, var1, this.elementData, var1 + var3, var4);
- }
-
- Iterator var5 = var2.iterator();
-
- for(int var6 = 0; var6 < var3; ++var6) {
- this.elementData[var1++] = var5.next();
- }
-
- this.elementCount += var3;
- return var3 != 0;
- } else {
- throw new ArrayIndexOutOfBoundsException(var1);
- }
- }
-
- public synchronized boolean equals(Object var1) {
- return super.equals(var1);
- }
-
- public synchronized int hashCode() {
- return super.hashCode();
- }
-
- public synchronized String toString() {
- return super.toString();
- }
-
- public List subList(int var1, int var2) {
- return Collections.synchronizedList(super.subList(var1, var2), this);
- }
-
- protected void removeRange(int var1, int var2) {
- ++super.modCount;
- int var3 = this.elementCount - var2;
- System.arraycopy(this.elementData, var2, this.elementData, var1, var3);
-
- for(int var4 = this.elementCount - (var2 - var1); this.elementCount != var4; this.elementData[--this.elementCount] = null) {
- }
-
- }
- }
-