blob: 1eafe57b9bb19d8b8ac187683dcef9c013f30d9a (
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.Enumeration;
import java.util.Vector;
public class MetaEnumeration implements Enumeration {
private Vector v;
private int index;
MetaEnumeration(Vector v) {
assert v.size() > 0;
this.v = v;
this.index = 0;
this.advanceToNext();
}
@Override
public boolean hasMoreElements() {
return ((Enumeration)this.v.elementAt(this.index)).hasMoreElements();
}
@Override
public Object nextElement() {
Object e = ((Enumeration)this.v.elementAt(this.index)).nextElement();
this.advanceToNext();
return e;
}
private void advanceToNext() {
while (!((Enumeration)this.v.elementAt(this.index)).hasMoreElements()) {
if (++this.index == this.v.size()) {
this.index--;
break;
}
}
}
}
|