// $Id: ShortEnumeration.java,v 1.1.1.1 1999/12/05 22:19:52 mpp Exp $
/*
 * ShortEnumeration
 * A simple class which allows creation of short enumerations on-the-fly.
 */

package IR2;

import java.util.*;

public class ShortEnumeration implements Enumeration {
  private Object list[];
  private int current;

  public ShortEnumeration(Object l[]) { current = 0; list = l; }
  public ShortEnumeration()           { current = 0; list = new Object[0]; }
  public ShortEnumeration(Object a) {
	current = 0; list = new Object[1]; list[0] = a;
  }
  public ShortEnumeration(Object a, Object b) {
	current = 0; list = new Object[2]; list[0] = a; list[1] = b;
  }
  public ShortEnumeration(Object a, Object b, Object c) {
	current = 0; list = new Object[3]; list[0] = a; list[1] = b; list[2] = c;
  }

  public boolean hasMoreElements() {
	return (current < list.length);
  }
  public Object nextElement() throws NoSuchElementException {
	if (current >= list.length)
	  throw new NoSuchElementException();
	return list[current++];
  }
}
