01: /*
02: *
03: * Copyright (c) 2002 Adrian Price. All rights reserved.
04: */
05:
06: package org.enhydra.shark.api.client.wfservice;
07:
08: import java.util.NoSuchElementException;
09:
10: import org.enhydra.shark.api.client.wfmc.wapi.WMIterator;
11: import org.enhydra.shark.api.client.wfmc.wapi.WMNoMoreDataException;
12:
13: /**
14: * Iterator for retrieving WAPI2 entities.
15: *
16: * @author Adrian Price
17: */
18: public class WMEntityIterator extends WMIterator {
19: private WMEntity[] array;
20:
21: /**
22: * Retrieves the next entity.
23: *
24: * @return The entity.
25: * @throws WMNoMoreDataException if no more data are available.
26: */
27: WMEntity tsNext() throws WMNoMoreDataException {
28: try {
29: return array[cursor++];
30: } catch (Throwable _) {
31: throw new WMNoMoreDataException();
32: }
33: }
34:
35: public Object next() {
36: try {
37: return tsNext();
38: } catch (WMNoMoreDataException e) {
39: throw new NoSuchElementException(e.getMessage());
40: }
41: }
42:
43: public WMEntity[] getArray() {
44: return array;
45: }
46:
47: public void setArray(WMEntity[] array) {
48: this.array = array;
49: }
50: }
|