|
SetEnumeration.java
|
//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\ // PLEASE DO NOT EDIT WITHOUT THE EXPLICIT CONSENT OF THE AUTHOR! \\ //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\ package hlt.language.util; import java.util.Enumeration; import java.util.NoSuchElementException;
|
This provides an enumeration for SetOf objects.
NB: once built with the constructor
SetEnumeration(s), an enumeration will not be altered if a
set
|
public class SetEnumeration implements Enumeration { private SetOf set; private int position = 0; private int[] indices; SetEnumeration (SetOf set) { setupEnumeration(set); } private void setupEnumeration (SetOf set) { if (set.indices == null) set.buildIndices(); this.indices = set.indices; this.set = set; } public SetEnumeration reset (SetOf set) { setupEnumeration(set); return this; } public final boolean hasMoreElements () { return (indices != null) && (position < indices.length); } public final Object nextElement () { return (indices == null) ? null : set.base.get(indices[position++]); } }
This file was generated on Sat May 11 08:40:08 CEST 2019 from file SetEnumeration.java
by the hlt.language.tools.Hilite Java tool written by Hassan Aït-Kaci