blob: 1f144a3f828396960a6bd7e4f460b47be110ea38 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
package NET.worlds.scape;
import java.util.Vector;
public class ShallowEnumeration extends DeepEnumeration<Object> {
public ShallowEnumeration(SuperRoot o) {
this.roots.addElement(o);
o.getChildren(this);
}
@Override
protected void getNextElement() {
this.valueRetrieved = false;
if (!this.roots.isEmpty()) {
this.nextValue = this.roots.elementAt(this.roots.size() - 1);
assert this.nextValue != null;
this.roots.removeElementAt(this.roots.size() - 1);
} else if (this.currentIndex >= 0) {
try {
this.nextValue = (SuperRoot)this.currentVector.elementAt(this.currentIndex--);
} catch (ArrayIndexOutOfBoundsException var2) {
this.currentIndex = this.currentVector.size() - 1;
this.getNextElement();
}
assert this.nextValue != null;
} else if (!this.vectors.isEmpty()) {
this.currentVector = (Vector<Object>)this.vectors.elementAt(this.vectors.size() - 1);
this.currentIndex = this.currentVector.size() - 1;
this.vectors.removeElementAt(this.vectors.size() - 1);
this.getNextElement();
} else {
this.nextValue = null;
}
}
}
|