home *** CD-ROM | disk | FTP | other *** search
- package java.util;
-
- class LinkedList$ListItr implements ListIterator {
- private LinkedList.Entry lastReturned;
- private LinkedList.Entry next;
- private int nextIndex;
- private int expectedModCount;
- // $FF: synthetic field
- private final LinkedList this$0;
-
- LinkedList$ListItr(LinkedList var1, int var2) {
- this.this$0 = var1;
- this.lastReturned = LinkedList.access$000(this.this$0);
- this.expectedModCount = this.this$0.modCount;
- if (var2 >= 0 && var2 <= LinkedList.access$100(var1)) {
- if (var2 < LinkedList.access$100(var1) / 2) {
- this.next = LinkedList.access$000(var1).next;
-
- for(this.nextIndex = 0; this.nextIndex < var2; ++this.nextIndex) {
- this.next = this.next.next;
- }
- } else {
- this.next = LinkedList.access$000(var1);
-
- for(this.nextIndex = LinkedList.access$100(var1); this.nextIndex > var2; --this.nextIndex) {
- this.next = this.next.previous;
- }
- }
-
- } else {
- throw new IndexOutOfBoundsException("Index: " + var2 + ", Size: " + LinkedList.access$100(var1));
- }
- }
-
- public boolean hasNext() {
- return this.nextIndex != LinkedList.access$100(this.this$0);
- }
-
- public Object next() {
- this.checkForComodification();
- if (this.nextIndex == LinkedList.access$100(this.this$0)) {
- throw new NoSuchElementException();
- } else {
- this.lastReturned = this.next;
- this.next = this.next.next;
- ++this.nextIndex;
- return this.lastReturned.element;
- }
- }
-
- public boolean hasPrevious() {
- return this.nextIndex != 0;
- }
-
- public Object previous() {
- if (this.nextIndex == 0) {
- throw new NoSuchElementException();
- } else {
- this.lastReturned = this.next = this.next.previous;
- --this.nextIndex;
- this.checkForComodification();
- return this.lastReturned.element;
- }
- }
-
- public int nextIndex() {
- return this.nextIndex;
- }
-
- public int previousIndex() {
- return this.nextIndex - 1;
- }
-
- public void remove() {
- LinkedList.access$200(this.this$0, this.lastReturned);
- if (this.next == this.lastReturned) {
- this.next = this.lastReturned.next;
- } else {
- --this.nextIndex;
- }
-
- this.lastReturned = LinkedList.access$000(this.this$0);
- ++this.expectedModCount;
- }
-
- public void set(Object var1) {
- if (this.lastReturned == LinkedList.access$000(this.this$0)) {
- throw new IllegalStateException();
- } else {
- this.checkForComodification();
- this.lastReturned.element = var1;
- }
- }
-
- public void add(Object var1) {
- this.checkForComodification();
- this.lastReturned = LinkedList.access$000(this.this$0);
- LinkedList.access$300(this.this$0, var1, this.next);
- ++this.nextIndex;
- ++this.expectedModCount;
- }
-
- final void checkForComodification() {
- if (this.this$0.modCount != this.expectedModCount) {
- throw new ConcurrentModificationException();
- }
- }
- }
-