home *** CD-ROM | disk | FTP | other *** search
/ PC Online 1999 November / PCONLINE_11_99.ISO / filesbbs / OS2 / APCHSSL2.ZIP / OS2HTTPD / jserv / com / bitmechanic / util / EnumerationStack.class (.txt) < prev    next >
Encoding:
Java Class File  |  1999-02-02  |  1.0 KB  |  48 lines

  1. package com.bitmechanic.util;
  2.  
  3. import java.util.Enumeration;
  4. import java.util.Stack;
  5.  
  6. public class EnumerationStack implements Enumeration {
  7.    private Stack stack = new Stack();
  8.    // $FF: renamed from: enum java.util.Enumeration
  9.    private Enumeration field_0;
  10.  
  11.    public EnumerationStack() {
  12.    }
  13.  
  14.    public EnumerationStack(Enumeration var1) {
  15.       this.field_0 = var1;
  16.    }
  17.  
  18.    public void push(Enumeration var1) {
  19.       if (this.field_0 == null) {
  20.          this.field_0 = var1;
  21.       } else {
  22.          this.stack.push(var1);
  23.       }
  24.    }
  25.  
  26.    public boolean hasMoreElements() {
  27.       if (this.field_0 != null && this.field_0.hasMoreElements()) {
  28.          return true;
  29.       } else if (!this.stack.empty()) {
  30.          this.field_0 = (Enumeration)this.stack.pop();
  31.          return this.hasMoreElements();
  32.       } else {
  33.          return false;
  34.       }
  35.    }
  36.  
  37.    public Object nextElement() {
  38.       if (this.field_0 != null && this.field_0.hasMoreElements()) {
  39.          return this.field_0.nextElement();
  40.       } else if (!this.stack.empty()) {
  41.          this.field_0 = (Enumeration)this.stack.pop();
  42.          return this.nextElement();
  43.       } else {
  44.          return null;
  45.       }
  46.    }
  47. }
  48.