gvsig-tools / org.gvsig.tools / library / trunk / org.gvsig.tools / org.gvsig.tools.lib / src / main / java / org / gvsig / tools / dynobject / DynObjectSet.java @ 1860
History | View | Annotate | Download (5.85 KB)
1 | 802 | cordinyana | /**
|
---|---|---|---|
2 | * gvSIG. Desktop Geographic Information System.
|
||
3 | 300 | cordinyana | *
|
4 | 802 | cordinyana | * Copyright (C) 2007-2013 gvSIG Association.
|
5 | *
|
||
6 | 300 | cordinyana | * This program is free software; you can redistribute it and/or
|
7 | * modify it under the terms of the GNU General Public License
|
||
8 | * as published by the Free Software Foundation; either version 2
|
||
9 | * of the License, or (at your option) any later version.
|
||
10 | 802 | cordinyana | *
|
11 | 300 | cordinyana | * This program is distributed in the hope that it will be useful,
|
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
14 | * GNU General Public License for more details.
|
||
15 | 802 | cordinyana | *
|
16 | 300 | cordinyana | * You should have received a copy of the GNU General Public License
|
17 | * along with this program; if not, write to the Free Software
|
||
18 | 802 | cordinyana | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
19 | 300 | cordinyana | * MA 02110-1301, USA.
|
20 | 802 | cordinyana | *
|
21 | * For any additional information, do not hesitate to contact us
|
||
22 | * at info AT gvsig.com, or visit our website www.gvsig.com.
|
||
23 | 300 | cordinyana | */
|
24 | 105 | cordinyana | /*
|
25 | 300 | cordinyana | * AUTHORS (In addition to CIT):
|
26 | * 2010 {} {{Task}}
|
||
27 | */
|
||
28 | 105 | cordinyana | package org.gvsig.tools.dynobject; |
29 | |||
30 | import org.gvsig.tools.dispose.Disposable; |
||
31 | import org.gvsig.tools.dispose.DisposableIterator; |
||
32 | import org.gvsig.tools.exception.BaseException; |
||
33 | 300 | cordinyana | import org.gvsig.tools.observer.Observable; |
34 | 105 | cordinyana | import org.gvsig.tools.visitor.IndexedVisitable; |
35 | |||
36 | /**
|
||
37 | * A set of iterable DynObject objects.
|
||
38 | *
|
||
39 | * @author 2010- C?sar Ordi?ana - gvSIG team
|
||
40 | */
|
||
41 | 300 | cordinyana | public interface DynObjectSet extends Disposable, IndexedVisitable, Observable { |
42 | 105 | cordinyana | |
43 | 300 | cordinyana | public static interface Notification { |
44 | 105 | cordinyana | |
45 | 300 | cordinyana | static final String EDITION_STATUS_CHANGE = |
46 | "edition_status_change_DynObjectSet";
|
||
47 | 105 | cordinyana | |
48 | 300 | cordinyana | static final String DATA_CHANGED = "data_changed_DynObjectSet"; |
49 | 105 | cordinyana | |
50 | 300 | cordinyana | String getType();
|
51 | } |
||
52 | |||
53 | /**
|
||
54 | * Returns the number of {@link DynObject}(s) contained in this
|
||
55 | * DynObjectSet.
|
||
56 | *
|
||
57 | * @return number of {@link DynObject}(s) contained in this DynObjectSet.
|
||
58 | *
|
||
59 | * @throws BaseException
|
||
60 | */
|
||
61 | long getSize() throws BaseException; |
||
62 | |||
63 | /**
|
||
64 | * Returns an iterator over the elements in this collection, in the order
|
||
65 | * (if any) defined when the collection was obtained.
|
||
66 | *
|
||
67 | * The iterator starts at the specified position in this collection. The
|
||
68 | * specified index indicates the first element that would be returned by an
|
||
69 | * initial call to the <tt>next</tt> method. An initial call to the
|
||
70 | * <tt>previous</tt> method would return the element with the specified
|
||
71 | * index minus one.
|
||
72 | *
|
||
73 | * <p>
|
||
74 | * <em>
|
||
75 | * <strong>NOTE:</strong> if you use this method to get the iterator, you
|
||
76 | * must get sure the iterator is disposed (@see
|
||
77 | * {@link DisposableIterator#dispose()}) in any case, even if an error occurs
|
||
78 | * while getting the data. It is recommended to use the <code>accept</code>
|
||
79 | * methods instead, which handle everything for you.
|
||
80 | * Take into account the accept methods may use a fast iterator to
|
||
81 | * get the DynObjects.
|
||
82 | * </em>
|
||
83 | * </p>
|
||
84 | *
|
||
85 | * @see #accept(org.gvsig.tools.visitor.Visitor)
|
||
86 | * @see #accept(org.gvsig.tools.visitor.Visitor, long)
|
||
87 | *
|
||
88 | * @param index
|
||
89 | * index of first element to be returned from the iterator (by a
|
||
90 | * call to the <tt>next</tt> method).
|
||
91 | * @return an iterator of the elements in this collection (in proper
|
||
92 | * sequence), starting at the specified position in the collection.
|
||
93 | * @throws BaseException
|
||
94 | * if the index is out of range (index < 0 || index >
|
||
95 | * size()).
|
||
96 | */
|
||
97 | DisposableIterator iterator(long index) throws BaseException; |
||
98 | |||
99 | /**
|
||
100 | * Returns an iterator over the elements in this collection, in the order
|
||
101 | * (if any) defined when the collection was obtained.
|
||
102 | *
|
||
103 | * <p>
|
||
104 | * <em>
|
||
105 | * <strong>NOTE:</strong> if you use this method to get the iterator, you
|
||
106 | * must get sure the iterator is disposed (@see
|
||
107 | * {@link DisposableIterator#dispose()}) in any case, even if an error occurs
|
||
108 | * while getting the data. It is recommended to use the <code>accept</code>
|
||
109 | * methods instead, which handle everything for you.
|
||
110 | * Take into account the accept methods may use a fast iterator to
|
||
111 | * get the DynObjects.
|
||
112 | * </em>
|
||
113 | * </p>
|
||
114 | *
|
||
115 | * @see #accept(org.gvsig.tools.visitor.Visitor)
|
||
116 | * @see #accept(org.gvsig.tools.visitor.Visitor, long)
|
||
117 | *
|
||
118 | * @return an iterator of the elements in this collection (in proper
|
||
119 | * sequence).
|
||
120 | *
|
||
121 | * @throws BaseException
|
||
122 | */
|
||
123 | DisposableIterator iterator() throws BaseException;
|
||
124 | |||
125 | /**
|
||
126 | * Indicates whether this DynObjectSet contains zero DynObjects.
|
||
127 | *
|
||
128 | * @return true if this DynObjectSet is empty, false otherwise.
|
||
129 | *
|
||
130 | * @throws BaseException
|
||
131 | */
|
||
132 | boolean isEmpty() throws BaseException; |
||
133 | |||
134 | /**
|
||
135 | * Tells if DynObject deletion is enabled into this set.
|
||
136 | *
|
||
137 | * @return if DynObject deletion is enabled into this set
|
||
138 | */
|
||
139 | boolean isDeleteEnabled();
|
||
140 | |||
141 | /**
|
||
142 | * Deletes a DynObject from this set. Depending on the inner set
|
||
143 | * implementation that may mean also the data will be removed from a
|
||
144 | * persistent state.
|
||
145 | *
|
||
146 | * @param dynObject
|
||
147 | * to remove
|
||
148 | * @throws BaseException
|
||
149 | * if there is an error removing the DynObject
|
||
150 | */
|
||
151 | void delete(DynObject dynObject) throws BaseException; |
||
152 | |||
153 | /**
|
||
154 | * Tells if DynObject updates are enabled into this set.
|
||
155 | *
|
||
156 | * @return if DynObject updates are enabled into this set
|
||
157 | */
|
||
158 | boolean isUpdateEnabled();
|
||
159 | |||
160 | /**
|
||
161 | * Updates a DynObject from this set. Depending on the inner set
|
||
162 | * implementation that may mean also the data will be updated in a
|
||
163 | * persistent state.
|
||
164 | *
|
||
165 | * @param dynObject
|
||
166 | * to update
|
||
167 | * @throws BaseException
|
||
168 | * if there is an error updating the DynObject
|
||
169 | */
|
||
170 | void update(DynObject dynObject) throws BaseException; |
||
171 | } |