From: adam Date: Sun, 2 May 2004 08:13:40 +0000 (+0000) Subject: added CounterEnumeration X-Git-Url: http://git.megacz.com/?p=org.ibex.core.git;a=commitdiff_plain;h=c00e06eb2c3ee761a75f138e081e914960b1c30b added CounterEnumeration darcs-hash:20040502081340-5007d-cf596e0400662d929b67780c947cb8e48173c4e4.gz --- diff --git a/src/org/ibex/util/CounterEnumeration.java b/src/org/ibex/util/CounterEnumeration.java new file mode 100644 index 0000000..5a01f3e --- /dev/null +++ b/src/org/ibex/util/CounterEnumeration.java @@ -0,0 +1,17 @@ +// Copyright (C) 2004 Adam Megacz all rights reserved. +// +// You may modify, copy, and redistribute this code under the terms of +// the GNU Library Public License version 2.1, with the exception of +// the portion of clause 6a after the semicolon (aka the "obnoxious +// relink clause") +package org.ibex.util; +import java.util.*; + +public class CounterEnumeration implements Enumeration { + public final int max; + private int cur = 0; + public CounterEnumeration(int i) { max = i; } + public void reset() { cur = 0; } + public boolean hasMoreElements() { return cur < max; } + public Object nextElement() { return new Integer(cur++); } +}