home *** CD-ROM | disk | FTP | other *** search
- package COM.objectspace.jgl;
-
- public final class HashSetIterator implements ForwardIterator {
- HashSet myHashSet;
- HashSet.HashSetNode myNode;
-
- public HashSetIterator() {
- }
-
- public HashSetIterator(HashSetIterator var1) {
- this.myHashSet = var1.myHashSet;
- this.myNode = var1.myNode;
- }
-
- HashSetIterator(HashSet.HashSetNode var1, HashSet var2) {
- this.myHashSet = var2;
- this.myNode = var1;
- }
-
- public Object clone() {
- return new HashSetIterator(this);
- }
-
- public boolean equals(Object var1) {
- if (var1 instanceof HashSetIterator) {
- HashSetIterator var2 = (HashSetIterator)var1;
- if (this.myNode == var2.myNode || false) {
- return true;
- }
- }
-
- return false;
- }
-
- public boolean equals(HashSetIterator var1) {
- return this.myNode == var1.myNode;
- }
-
- public boolean atBegin() {
- if (this.myHashSet == null) {
- return false;
- } else {
- for(int var1 = 0; var1 < this.myHashSet.length; ++var1) {
- if (this.myHashSet.buckets[var1] != null) {
- if (this.myNode != this.myHashSet.buckets[var1]) {
- return false;
- }
-
- return true;
- }
- }
-
- return true;
- }
- }
-
- public boolean atEnd() {
- return this.myNode == null;
- }
-
- public boolean hasMoreElements() {
- return this.myNode != null;
- }
-
- public void advance() {
- this.myNode = this.myNode.next != null ? this.myNode.next : this.next(this.myNode);
- }
-
- public void advance(int var1) {
- if (var1 < 0) {
- throw new InvalidOperationException("Attempt to advance a ForwardIterator in the wrong direction.");
- } else {
- while(var1-- > 0) {
- this.advance();
- }
-
- }
- }
-
- public Object nextElement() {
- Object var1 = this.myNode.object;
- this.myNode = this.myNode.next != null ? this.myNode.next : this.next(this.myNode);
- return var1;
- }
-
- public Object get() {
- return this.myNode.object;
- }
-
- public void put(Object var1) {
- this.myNode.object = var1;
- }
-
- public int distance(ForwardIterator var1) {
- HashSet.HashSetNode var2 = this.myNode;
- HashSet.HashSetNode var3 = ((HashSetIterator)var1).myNode;
-
- int var4;
- for(var4 = 0; this.myNode != var3; this.myNode = this.myNode.next != null ? this.myNode.next : this.next(this.myNode)) {
- ++var4;
- }
-
- this.myNode = var2;
- return var4;
- }
-
- public Container getContainer() {
- return this.myHashSet;
- }
-
- private HashSet.HashSetNode next(HashSet.HashSetNode var1) {
- for(int var2 = var1.hash % this.myHashSet.length + 1; var2 < this.myHashSet.length; ++var2) {
- if (this.myHashSet.buckets[var2] != null) {
- return this.myHashSet.buckets[var2];
- }
- }
-
- return null;
- }
- }
-