01: package org.sakaibrary.osid.repository.xserver;
02:
03: /**********************************************************************************
04: * $URL: https://source.sakaiproject.org/svn/citations/tags/sakai_2-4-1/citations-osid/xserver/src/java/org/sakaibrary/osid/repository/xserver/ObjectIterator.java $
05: * $Id: ObjectIterator.java 22640 2007-03-14 21:04:07Z jimeng@umich.edu $
06: **********************************************************************************
07: *
08: * Copyright (c) 2003, 2004, 2005 The Regents of the University of Michigan, Trustees of Indiana University,
09: * Board of Trustees of the Leland Stanford, Jr., University, and The MIT Corporation
10: *
11: * Licensed under the Educational Community License Version 1.0 (the "License");
12: * By obtaining, using and/or copying this Original Work, you agree that you have read,
13: * understand, and will comply with the terms and conditions of the Educational Community License.
14: * You may obtain a copy of the License at:
15: *
16: * http://cvs.sakaiproject.org/licenses/license_1_0.html
17: *
18: * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
19: * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
20: * AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
21: * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22: * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23: *
24: **********************************************************************************/
25: /**
26: * @author Massachusetts Institute of Techbology, Sakai Software Development Team
27: * @version
28: */
29: public class ObjectIterator implements org.osid.shared.ObjectIterator {
30: private java.util.Vector vector = new java.util.Vector();
31: private int i = 0;
32:
33: public ObjectIterator(java.util.Vector vector)
34: throws org.osid.shared.SharedException {
35: this .vector = vector;
36: }
37:
38: public boolean hasNextObject()
39: throws org.osid.shared.SharedException {
40: return i < vector.size();
41: }
42:
43: public java.io.Serializable nextObject()
44: throws org.osid.shared.SharedException {
45: if (i < vector.size()) {
46: return (java.io.Serializable) vector.elementAt(i++);
47: } else {
48: throw new org.osid.shared.SharedException(
49: org.osid.shared.SharedException.NO_MORE_ITERATOR_ELEMENTS);
50: }
51: }
52: }
|