summaryrefslogtreecommitdiff
path: root/NET/worlds/scape/EnumProperties.java
blob: a6fbdc9a7a519e9b214f68945b478e378afd9309 (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
39
40
41
42
43
44
45
46
package NET.worlds.scape;

import java.util.Enumeration;
import java.util.NoSuchElementException;

public class EnumProperties implements Enumeration<Object> {
   private Properties props;
   private Property next;
   private int index = 0;

   public EnumProperties(Object obj) {
      if (obj instanceof Properties) {
         this.props = (Properties)obj;
      }
   }

   @Override
   public boolean hasMoreElements() {
      if (this.props != null && this.next == null) {
         try {
            this.next = (Property)this.props.properties(this.index++, 0, 0, null);

            assert this.next.index == this.index - 1;
         } catch (NoSuchPropertyException var2) {
         }
      }

      return this.next != null;
   }

   @Override
   public Object nextElement() {
      if (this.hasMoreElements()) {
         Property var2;
         try {
            var2 = this.next;
         } finally {
            this.next = null;
         }

         return var2;
      } else {
         throw new NoSuchElementException();
      }
   }
}