summaryrefslogtreecommitdiff
path: root/NET/worlds/scape/DeepEnumeration.java
diff options
context:
space:
mode:
authorFuwn <[email protected]>2021-05-03 16:38:41 -0700
committerFuwn <[email protected]>2021-05-03 16:38:41 -0700
commite1e781bb2135ef78592226f1a3eaba4925702f1f (patch)
tree8a5b590463ed413e1c6eabb719130e701b95ca63 /NET/worlds/scape/DeepEnumeration.java
downloadworlds.jar-e1e781bb2135ef78592226f1a3eaba4925702f1f.tar.xz
worlds.jar-e1e781bb2135ef78592226f1a3eaba4925702f1f.zip
:star:HEADmain
Diffstat (limited to 'NET/worlds/scape/DeepEnumeration.java')
-rw-r--r--NET/worlds/scape/DeepEnumeration.java193
1 files changed, 193 insertions, 0 deletions
diff --git a/NET/worlds/scape/DeepEnumeration.java b/NET/worlds/scape/DeepEnumeration.java
new file mode 100644
index 0000000..82000a6
--- /dev/null
+++ b/NET/worlds/scape/DeepEnumeration.java
@@ -0,0 +1,193 @@
+/* */ package NET.worlds.scape;
+/* */
+/* */ import java.util.Enumeration;
+/* */ import java.util.Vector;
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ public class DeepEnumeration<K>
+/* */ implements Enumeration<K>
+/* */ {
+/* 27 */ Vector<SuperRoot> roots = new Vector();
+/* */
+/* */
+/* */
+/* */
+/* 32 */ Vector<Vector<K>> vectors = new Vector();
+/* */
+/* */
+/* */
+/* */
+/* */
+/* 38 */ Vector<K> currentVector = null;
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* 46 */ int currentIndex = -1;
+/* */
+/* */
+/* */
+/* */
+/* */
+/* 52 */ SuperRoot nextValue = null;
+/* */
+/* */
+/* */
+/* */ public DeepEnumeration(SuperRoot o)
+/* */ {
+/* 58 */ addChildElement(o);
+/* */ }
+/* */
+/* */
+/* */
+/* */ public DeepEnumeration(Vector<K> v)
+/* */ {
+/* 65 */ addChildVector(v);
+/* */ }
+/* */
+/* */
+/* */
+/* */ public DeepEnumeration(Enumeration<K> 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<K> v)
+/* */ {
+/* 146 */ assert (v != null);
+/* 147 */ this.vectors.addElement(v);
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ public void addChildEnumeration(Enumeration<K> e)
+/* */ {
+/* 156 */ if ((!$assertionsDisabled) && (e == null)) throw new AssertionError();
+/* 157 */ while (e.hasMoreElements()) {
+/* 158 */ addChildElement(e.nextElement());
+/* */ }
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* */ public void addChildVectorWithNulls(Vector<K> 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<K> 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
+ */ \ No newline at end of file