From c00e06eb2c3ee761a75f138e081e914960b1c30b Mon Sep 17 00:00:00 2001 From: adam Date: Sun, 2 May 2004 08:13:40 +0000 Subject: [PATCH] added CounterEnumeration darcs-hash:20040502081340-5007d-cf596e0400662d929b67780c947cb8e48173c4e4.gz --- src/org/ibex/util/CounterEnumeration.java | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 src/org/ibex/util/CounterEnumeration.java 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++); } +} -- 1.7.10.4