69 |
69 |
|
70 |
70 |
/**
|
71 |
71 |
* <p>
|
72 |
|
* Number of extents stored.
|
|
72 |
* Number of previous extents stored.
|
73 |
73 |
* </p>
|
74 |
74 |
*
|
75 |
75 |
* @see #hasPrevious()
|
... | ... | |
79 |
79 |
*/
|
80 |
80 |
private int num = 0;
|
81 |
81 |
|
|
82 |
/**
|
|
83 |
* <p>
|
|
84 |
* Number of next extents stored.
|
|
85 |
* </p>
|
|
86 |
*
|
|
87 |
* @see #hasNext()
|
|
88 |
* @see #putNext(Rectangle2D)
|
|
89 |
* @see #getNext()
|
|
90 |
* @see #removeNext()
|
|
91 |
*/
|
82 |
92 |
private int numNext = 0;
|
83 |
93 |
|
84 |
94 |
/**
|
... | ... | |
108 |
118 |
|
109 |
119 |
/**
|
110 |
120 |
* <p>
|
111 |
|
* Appends the specified extent to the end of this history.
|
|
121 |
* Appends the specified extent at the end of the array of previous zooms.
|
112 |
122 |
* </p>
|
113 |
123 |
*
|
114 |
124 |
* @param ext the new extent
|
... | ... | |
129 |
139 |
}
|
130 |
140 |
}
|
131 |
141 |
}
|
132 |
|
|
|
142 |
|
|
143 |
/**
|
|
144 |
* <p>
|
|
145 |
* Appends the specified extent at the end of the array of next zooms.
|
|
146 |
* </p>
|
|
147 |
*
|
|
148 |
* @param ext the new extent
|
|
149 |
* @see #getNext()
|
|
150 |
* @see #hasNext()
|
|
151 |
*/
|
133 |
152 |
public void putNext(Rectangle2D ext) {
|
134 |
|
if ((ext != null) && ((numNext < 1) || (ext != extentsNext[numNext - 1])) ) {
|
|
153 |
if ((ext != null) && ((numNext < 1) || (ext != extentsNext[numNext - 1]))) {
|
135 |
154 |
if (numNext < (NUMREC)) {
|
136 |
155 |
extentsNext[numNext] = ext;
|
137 |
156 |
numNext++;
|
138 |
|
} else {
|
|
157 |
}
|
|
158 |
else {
|
139 |
159 |
for (int i = 0; i < (NUMREC - 1); i++) {
|
140 |
|
extentsNext[i] = extentsNext[i+1];
|
|
160 |
extentsNext[i] = extentsNext[i + 1];
|
141 |
161 |
}
|
142 |
162 |
extentsNext[numNext - 1] = ext;
|
143 |
163 |
}
|
... | ... | |
146 |
166 |
|
147 |
167 |
/**
|
148 |
168 |
* <p>
|
149 |
|
* Returns <code>true</code> if there are extents registered.
|
|
169 |
* Returns <code>true</code> if there are previous extents registered.
|
150 |
170 |
* </p>
|
151 |
171 |
*
|
152 |
|
* @return <code>true</code> if there are extents registered;
|
|
172 |
* @return <code>true</code> if there are previous extents registered;
|
153 |
173 |
* <code>false</code> otherwise
|
154 |
174 |
* @see #put(Rectangle2D)
|
155 |
175 |
* @see #removePrev()
|
... | ... | |
159 |
179 |
return num > 0;
|
160 |
180 |
}
|
161 |
181 |
|
|
182 |
/**
|
|
183 |
* <p>
|
|
184 |
* Returns <code>true</code> if there are next extents registered.
|
|
185 |
* </p>
|
|
186 |
*
|
|
187 |
* @return <code>true</code> if there are next extents registered;
|
|
188 |
* <code>false</code> otherwise
|
|
189 |
* @see #putNext(Rectangle2D)
|
|
190 |
* @see #removeNext()
|
|
191 |
* @see #getNext()
|
|
192 |
*/
|
162 |
193 |
public boolean hasNext() {
|
163 |
194 |
return numNext > 0;
|
164 |
195 |
}
|
165 |
196 |
|
166 |
197 |
/**
|
167 |
198 |
* <p>
|
168 |
|
* Returns the last extent in the history.
|
|
199 |
* Returns the last previous extent in the history.
|
169 |
200 |
* </p>
|
170 |
201 |
*
|
171 |
|
* @return the last extent in the history
|
|
202 |
* @return the last previous extent in the history
|
172 |
203 |
* @see #put(Rectangle2D)
|
173 |
204 |
* @see #getXMLEntity()
|
174 |
205 |
*/
|
... | ... | |
181 |
212 |
return ext;
|
182 |
213 |
}
|
183 |
214 |
|
|
215 |
/**
|
|
216 |
* <p>
|
|
217 |
* Returns the last next extent in the history.
|
|
218 |
* </p>
|
|
219 |
*
|
|
220 |
* @return the last next extent in the history
|
|
221 |
* @see #putNext(Rectangle2D)
|
|
222 |
* @see #getXMLEntity()
|
|
223 |
*/
|
184 |
224 |
public Rectangle2D getNext() {
|
185 |
225 |
if (numNext <= 0) {
|
186 |
226 |
return null;
|
... | ... | |
193 |
233 |
|
194 |
234 |
/**
|
195 |
235 |
* <p>
|
196 |
|
* Extracts (removing) the last extent from the history.
|
|
236 |
* Extracts (removing) the last previous extent from the history.
|
197 |
237 |
* </p>
|
198 |
238 |
*
|
199 |
|
* @return last extent in the history
|
|
239 |
* @return last previous extent in the history
|
200 |
240 |
* @see #hasPrevious()
|
201 |
241 |
*/
|
202 |
242 |
public Rectangle2D removePrev() {
|
... | ... | |
210 |
250 |
|
211 |
251 |
/**
|
212 |
252 |
* <p>
|
213 |
|
* Extracts (removing) the last extent from the history.
|
|
253 |
* Extracts (removing) the last next extent from the history.
|
214 |
254 |
* </p>
|
215 |
255 |
*
|
216 |
|
* @return last extent in the history
|
|
256 |
* @return last next extent in the history
|
217 |
257 |
* @see #hasNext()
|
218 |
258 |
*/
|
219 |
259 |
public Rectangle2D removeNext() {
|
... | ... | |
225 |
265 |
return ext;
|
226 |
266 |
}
|
227 |
267 |
|
|
268 |
/**
|
|
269 |
* <p>
|
|
270 |
* Sets to zero the number of next extents from the history.
|
|
271 |
* </p>
|
|
272 |
*
|
|
273 |
* @see #getNext()
|
|
274 |
* @see #hasNext()
|
|
275 |
*/
|
228 |
276 |
public void clear() {
|
229 |
277 |
numNext = 0;
|
230 |
278 |
}
|