home *** CD-ROM | disk | FTP | other *** search
/ S283 Planetary Science &n…he Search for Life DVD 2 / DVD-ROM.iso / install / jre1_3 / lib / rt.jar / java / security / PermissionsEnumerator.class (.txt) < prev    next >
Encoding:
Java Class File  |  1979-12-31  |  807 b   |  46 lines

  1. package java.security;
  2.  
  3. import java.util.Enumeration;
  4. import java.util.NoSuchElementException;
  5.  
  6. final class PermissionsEnumerator implements Enumeration {
  7.    private Enumeration perms;
  8.    private Enumeration permset;
  9.  
  10.    PermissionsEnumerator(Enumeration var1) {
  11.       this.perms = var1;
  12.       this.permset = this.getNextEnumWithMore();
  13.    }
  14.  
  15.    public synchronized boolean hasMoreElements() {
  16.       if (this.permset == null) {
  17.          return false;
  18.       } else if (this.permset.hasMoreElements()) {
  19.          return true;
  20.       } else {
  21.          this.permset = this.getNextEnumWithMore();
  22.          return this.permset != null;
  23.       }
  24.    }
  25.  
  26.    public synchronized Object nextElement() {
  27.       if (this.hasMoreElements()) {
  28.          return this.permset.nextElement();
  29.       } else {
  30.          throw new NoSuchElementException("PermissionsEnumerator");
  31.       }
  32.    }
  33.  
  34.    private Enumeration getNextEnumWithMore() {
  35.       while(this.perms.hasMoreElements()) {
  36.          PermissionCollection var1 = (PermissionCollection)this.perms.nextElement();
  37.          Enumeration var2 = var1.elements();
  38.          if (var2.hasMoreElements()) {
  39.             return var2;
  40.          }
  41.       }
  42.  
  43.       return null;
  44.    }
  45. }
  46.