home *** CD-ROM | disk | FTP | other *** search
- package sun.misc;
-
- import java.util.Enumeration;
- import java.util.NoSuchElementException;
-
- class CacheEnumerator implements Enumeration {
- boolean keys;
- int index;
- CacheEntry[] table;
- CacheEntry entry;
-
- CacheEnumerator(CacheEntry[] var1, boolean var2) {
- this.table = var1;
- this.keys = var2;
- this.index = var1.length;
- }
-
- public boolean hasMoreElements() {
- while(this.index >= 0) {
- while(this.entry != null) {
- if (this.entry.check() != null) {
- return true;
- }
-
- this.entry = this.entry.next;
- }
-
- while(--this.index >= 0 && (this.entry = this.table[this.index]) == null) {
- }
- }
-
- return false;
- }
-
- public Object nextElement() {
- while(this.index >= 0) {
- if (this.entry == null) {
- while(--this.index >= 0 && (this.entry = this.table[this.index]) == null) {
- }
- }
-
- if (this.entry != null) {
- CacheEntry var1 = this.entry;
- this.entry = var1.next;
- if (((Ref)var1).check() != null) {
- if (this.keys) {
- return var1.key;
- }
-
- return ((Ref)var1).check();
- }
- }
- }
-
- throw new NoSuchElementException("CacheEnumerator");
- }
- }
-