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