--- jsr166/src/main/java/util/Vector.java 2006/04/19 15:07:14 1.10 +++ jsr166/src/main/java/util/Vector.java 2006/04/21 20:49:03 1.12 @@ -1,5 +1,5 @@ /* - * @(#)Vector.java 1.103 05/12/06 + * %W% %E% * * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. @@ -49,7 +49,7 @@ package java.util; * * @author Lee Boynton * @author Jonathan Payne - * @version 1.103, 12/06/05 + * @version %I%, %G% * @see Collection * @see List * @see ArrayList @@ -1194,7 +1194,7 @@ public class Vector final int parentOffset; // index wrt parent int length; // length of sublist - VectorSubList(Vector base, AbstractList parent, int baseOffset, + VectorSubList(Vector base, AbstractList parent, int baseOffset, int fromIndex, int toIndex) { if (fromIndex < 0) throw new IndexOutOfBoundsException("fromIndex = " + fromIndex); @@ -1216,7 +1216,7 @@ public class Vector * Returns an IndexOutOfBoundsException with nicer message */ private IndexOutOfBoundsException indexError(int index) { - return new IndexOutOfBoundsException("Index: " + index + + return new IndexOutOfBoundsException("Index: " + index + ", Size: " + length); } @@ -1277,7 +1277,7 @@ public class Vector synchronized(base) { if (base.modCount != modCount) throw new ConcurrentModificationException(); - parent.removeRange(fromIndex + parentOffset, + parent.removeRange(fromIndex + parentOffset, toIndex + parentOffset); length -= (toIndex-fromIndex); modCount = base.modCount; @@ -1295,7 +1295,7 @@ public class Vector int cSize = c.size(); if (cSize==0) return false; - + if (base.modCount != modCount) throw new ConcurrentModificationException(); parent.addAll(parentOffset + index, c); @@ -1322,7 +1322,7 @@ public class Vector } public List subList(int fromIndex, int toIndex) { - return new VectorSubList(base, this, fromIndex + baseOffset, + return new VectorSubList(base, this, fromIndex + baseOffset, fromIndex, toIndex); } @@ -1331,7 +1331,7 @@ public class Vector return new VectorSubListIterator(this, 0); } } - + public synchronized ListIterator listIterator() { synchronized(base) { return new VectorSubListIterator(this, 0); @@ -1358,7 +1358,7 @@ public class Vector int fence; // Upper bound on cursor int lastRet; // Index of returned element, or -1 int expectedModCount; // Expected modCount of base Vector - + VectorSubListIterator(VectorSubList list, int index) { this.lastRet = -1; this.cursor = index; @@ -1368,23 +1368,23 @@ public class Vector this.base = list.base; this.expectedModCount = base.modCount; } - + public boolean hasNext() { return cursor < fence; } - + public boolean hasPrevious() { return cursor > 0; } - + public int nextIndex() { return cursor; } - + public int previousIndex() { return cursor - 1; } - + public E next() { int i = cursor; if (cursor >= fence) @@ -1394,7 +1394,7 @@ public class Vector cursor = i + 1; return (E)next; } - + public E previous() { int i = cursor - 1; if (i < 0) @@ -1404,7 +1404,7 @@ public class Vector cursor = i; return (E)prev; } - + public void set(E e) { if (lastRet < 0) throw new IllegalStateException(); @@ -1417,7 +1417,7 @@ public class Vector throw new ConcurrentModificationException(); } } - + public void remove() { int i = lastRet; if (i < 0) @@ -1435,7 +1435,7 @@ public class Vector throw new ConcurrentModificationException(); } } - + public void add(E e) { if (base.modCount != expectedModCount) throw new ConcurrentModificationException(); @@ -1455,4 +1455,4 @@ public class Vector } - +