/* */ package NET.worlds.scape; /* */ /* */ import java.util.Enumeration; /* */ import java.util.Vector; /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public class DeepEnumeration /* */ implements Enumeration /* */ { /* 27 */ Vector roots = new Vector(); /* */ /* */ /* */ /* */ /* 32 */ Vector> vectors = new Vector(); /* */ /* */ /* */ /* */ /* */ /* 38 */ Vector currentVector = null; /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* 46 */ int currentIndex = -1; /* */ /* */ /* */ /* */ /* */ /* 52 */ SuperRoot nextValue = null; /* */ /* */ /* */ /* */ public DeepEnumeration(SuperRoot o) /* */ { /* 58 */ addChildElement(o); /* */ } /* */ /* */ /* */ /* */ public DeepEnumeration(Vector v) /* */ { /* 65 */ addChildVector(v); /* */ } /* */ /* */ /* */ /* */ public DeepEnumeration(Enumeration e) /* */ { /* 72 */ addChildEnumeration(e); /* */ } /* */ /* */ /* */ /* */ public DeepEnumeration() {} /* */ /* */ /* */ /* 81 */ protected boolean valueRetrieved = true; /* */ /* */ public boolean hasMoreElements() { /* 84 */ if (this.valueRetrieved) /* 85 */ getNextElement(); /* 86 */ return this.nextValue != null; /* */ } /* */ /* */ public K nextElement() /* */ { /* 91 */ if (this.valueRetrieved) /* 92 */ getNextElement(); /* 93 */ this.valueRetrieved = true; /* */ /* */ /* 96 */ return this.nextValue; /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ protected void getNextElement() /* */ { /* 115 */ this.valueRetrieved = false; /* 116 */ if (!this.roots.isEmpty()) { /* 117 */ this.nextValue = ((SuperRoot)this.roots.elementAt(this.roots.size() - 1)); /* 118 */ this.roots.removeElementAt(this.roots.size() - 1); /* 119 */ assert (this.nextValue != null); /* 120 */ this.nextValue.getChildren(this); /* 121 */ } else if (this.currentIndex >= 0) { /* */ try { /* 123 */ this.nextValue = ((SuperRoot)this.currentVector.elementAt(this.currentIndex--)); /* */ } catch (ArrayIndexOutOfBoundsException e) { /* 125 */ this.currentIndex = (this.currentVector.size() - 1); /* 126 */ getNextElement(); /* */ } /* 128 */ assert (this.nextValue != null); /* 129 */ this.nextValue.getChildren(this); /* 130 */ } else if (!this.vectors.isEmpty()) { /* 131 */ this.currentVector = ((Vector)this.vectors.elementAt(this.vectors.size() - 1)); /* 132 */ this.currentIndex = (this.currentVector.size() - 1); /* 133 */ this.vectors.removeElementAt(this.vectors.size() - 1); /* 134 */ getNextElement(); /* */ } else { /* 136 */ this.nextValue = null; /* */ } /* */ } /* */ /* */ /* */ /* */ /* */ /* */ public void addChildVector(Vector v) /* */ { /* 146 */ assert (v != null); /* 147 */ this.vectors.addElement(v); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ public void addChildEnumeration(Enumeration e) /* */ { /* 156 */ if ((!$assertionsDisabled) && (e == null)) throw new AssertionError(); /* 157 */ while (e.hasMoreElements()) { /* 158 */ addChildElement(e.nextElement()); /* */ } /* */ } /* */ /* */ /* */ /* */ /* */ public void addChildVectorWithNulls(Vector v) /* */ { /* 167 */ assert (v != null); /* 168 */ for (int i = v.size() - 1; i >= 0; i--) { /* 169 */ Object obj = v.elementAt(i--); /* 170 */ if (obj != null) { /* 171 */ addChildElement(obj); /* */ } /* */ } /* */ } /* */ /* */ /* */ public void addChildElement(Object o) /* */ { /* 179 */ assert (o != null); /* 180 */ this.roots.addElement((SuperRoot)o); /* */ } /* */ /* */ public void addChildVectorAction(Vector actions) { /* 184 */ assert (actions != null); /* 185 */ this.vectors.addElement(actions); /* */ } /* */ } /* Location: C:\Program Files (x86)\Worlds Inc\WorldsPlayer - Win7\lib\worlds.jar!\NET\worlds\scape\DeepEnumeration.class * Java compiler version: 6 (50.0) * JD-Core Version: 0.7.1 */