package org.osidx.junit;

public class ObjectIterator
    implements org.osid.shared.ObjectIterator {

    private Object[] array;
    private int index;

    public ObjectIterator(Object[] array) {
	this.array = array;
	this.index = 0;
    }


    /**
     * Return true if there is an additional  Object ; false otherwise.
     *
     * @return boolean
     *
     * @throws org.osid.shared.SharedException An exception with one of the
     *         following messages defined in org.osid.shared.SharedException
     *         may be thrown:  {@link
     *         org.osid.shared.SharedException#UNKNOWN_TYPE UNKNOWN_TYPE},
     *         {@link org.osid.shared.SharedException#PERMISSION_DENIED
     *         PERMISSION_DENIED}, {@link
     *         org.osid.shared.SharedException#CONFIGURATION_ERROR
     *         CONFIGURATION_ERROR}, {@link
     *         org.osid.shared.SharedException#UNIMPLEMENTED UNIMPLEMENTED}
     */
    public boolean hasNextObject() 
	throws org.osid.shared.SharedException {
	
	if (index >= this.array.length) {
	    return (false);
	} else {
	    return (true);
	}
    }


    /**
     * Return the next Object.
     *
     * @return object
     *
     * @throws org.osid.shared.SharedException An exception with one of the
     *         following messages defined in org.osid.shared.SharedException
     *         may be thrown:  {@link
     *         org.osid.shared.SharedException#UNKNOWN_TYPE UNKNOWN_TYPE},
     *         {@link org.osid.shared.SharedException#PERMISSION_DENIED
     *         PERMISSION_DENIED}, {@link
     *         org.osid.shared.SharedException#CONFIGURATION_ERROR
     *         CONFIGURATION_ERROR}, {@link
     *         org.osid.shared.SharedException#UNIMPLEMENTED UNIMPLEMENTED},
     *         {@link
     *         org.osid.shared.SharedException#NO_MORE_ITERATOR_ELEMENTS
     *         NO_MORE_ITERATOR_ELEMENTS}
     */

    public java.io.Serializable nextObject() 
	throws org.osid.shared.SharedException {
	
	return ((java.io.Serializable) this.array[this.index++]);
    }
}
