/**
*#########################################################################
*
* A component of the Gatherer application, part of the Greenstone digital
* library suite from the New Zealand Digital Library Project at the
* University of Waikato, New Zealand.
*
*
*
* Author: John Thompson, Greenstone Digital Library, University of Waikato
*
*
*
* Copyright (C) 1999 New Zealand Digital Library Project
*
*
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*########################################################################
*/
package org.greenstone.gatherer.util;
/**************************************************************************************
* Title: Gatherer
* Description: The Gatherer: a tool for gathering and enriching a digital collection.
* Company: The University of Waikato
* Written: 15/07/02
* Revised: 04/10/02 - Commented
**************************************************************************************/
import java.util.Enumeration;
import java.util.Vector;
/** A Vector which also supports the enumeration interface.
* @author John Thompson
* @version 2.3
*/
public class EnumeratedVector
extends Vector
implements Enumeration {
/** The current index into our enumerated vector. */
private int index = 0;
/** Can we call nextElement() without running out of entries in the vector.
* @return true if there are elements remaining, false otherwise.
*/
public boolean hasMoreElements() {
return (index < size());
}
/** Retrieve the next element indicated by the current index.
* @return The next element as an Object.
*/
public Object nextElement() {
Object object = null;
if(index < size()) {
object = get(index);
index++;
}
return object;
}
}