Revision 42198

View differences:

trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.mapcontext/org.gvsig.fmap.mapcontext.api/src/main/java/org/gvsig/fmap/mapcontext/ExtentHistory.java
191 191

  
192 192
  /**
193 193
   * <p>
194
   * Returns the last previous extent in the history.
194
   * Returns the last previous extent from the history.
195 195
   * </p>
196 196
   *
197
   * @return the last previous extent in the history
197
   * @return the last previous extent from the history
198 198
   */
199 199
  public Rectangle2D getPrev() {
200 200
    if (numPrev <= 0) {
......
207 207

  
208 208
  /**
209 209
   * <p>
210
   * Returns the last next extent in the history.
210
   * Returns the last next extent from the history.
211 211
   * </p>
212 212
   *
213
   * @return the last next extent in the history
213
   * @return the last next extent from the history
214 214
   */
215 215
  public Rectangle2D getNext() {
216 216
    if (numNext <= 0) {
......
226 226
   * Extracts (removing) the last previous extent from the history.
227 227
   * </p>
228 228
   *
229
   * @return last previous extent in the history
229
   * @return last previous extent from the history
230 230
   */
231 231
  private Rectangle2D popPrev() {
232 232
    if (numPrev <= 0) {
......
242 242
   * Extracts (removing) the last next extent from the history.
243 243
   * </p>
244 244
   *
245
   * @return last next extent in the history
245
   * @return last next extent from the history
246 246
   */
247 247
  private Rectangle2D popNext() {
248 248
    if (numNext <= 0) {
......
273 273

  
274 274
  /**
275 275
   * <p>
276
   * Adds the current extent to the next extents history and sets the last
276
   * Adds the current extent to the next extent history and sets the last
277 277
   * previous extent as the new current extent.
278 278
   * </p>
279 279
   *
......
287 287
    currentExtent = popPrev();
288 288
    return currentExtent;
289 289
  }
290

  
290
  
291
  /**
292
   * <p>
293
   * Adds the specified extent to the next extent history.
294
   * If the array of next extents is complete, loses the
295
   * first extent of the array and adds the new one at the end.
296
   * </p>
297
   *  
298
   */
291 299
  private void pushNext(Rectangle2D ext) {
292 300
    if (numNext < (NUMREC)) {
293 301
      extentsNext[numNext] = ext;
......
303 311

  
304 312
  /**
305 313
   * <p>
306
   * Adds the current extent to the previous extents history and sets the last
314
   * Adds the current extent to the previous extent history and sets the last
307 315
   * next extent as the new current extent.
308 316
   * </p>
309 317
   * 
......
319 327
    return currentExtent;
320 328
  }
321 329

  
330
  /**
331
   * <p>
332
   * Adds the specified extent to the previous extent history.
333
   * If the array of previous extents is complete, loses the
334
   * first extent of the array and adds the new one at the end.
335
   * </p>
336
   *  
337
   */
322 338
  private void pushPrevious(Rectangle2D ext) {
323 339
    if (numPrev < (NUMREC)) {
324 340
      extentsPrev[numPrev] = ext;
......
331 347
    }
332 348
  }
333 349
  
350
  /**
351
   * <p>
352
   * Returns the current extent.
353
   * </p>
354
   *  
355
   * @return the current extent
356
   */
334 357
  public Rectangle2D getCurrent() {
335 358
    return currentExtent;
336 359
  }
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.mapcontext/org.gvsig.fmap.mapcontext.api/src/test/java/org/gvsig/fmap/mapcontext/ExtentHistoryTest.java
58 58
		history.put(rectangle2);
59 59
		history.put(rectangle);
60 60

  
61
		assertEquals(rectangle, history.getPrev());
61
		assertEquals(rectangle2, history.getPrev());
62 62

  
63 63
		history = new ExtentHistory(2);
64 64

  
......
66 66
		history.put(rectangle2);
67 67
		history.put(rectangle3);
68 68

  
69
		assertEquals(rectangle3, history.getPrev());
69
		assertEquals(rectangle2, history.getPrev());
70 70
	}
71 71

  
72 72
	/**
......
80 80

  
81 81
		Rectangle2D rectangle = new Rectangle2D.Double(1, 1, 2, 2);
82 82
		history.put(rectangle);
83

  
83
		assertFalse(history.hasPrevious());
84
 
85
		Rectangle2D rectangle2 = new Rectangle2D.Double(2, 2, 3, 3);
86
    history.put(rectangle2);
84 87
		assertTrue(history.hasPrevious());
85 88

  
86
		history.setPreviousExtent(); //.getPrev();//.removePrev();
89
		history.setPreviousExtent();
87 90
		assertFalse(history.hasPrevious());
88 91
	}
89 92

  
......
99 102
    Rectangle2D rectangle = new Rectangle2D.Double(1, 1, 2, 2);
100 103
    history.put(rectangle);
101 104

  
102
    assertTrue(history.hasPrevious());
103

  
104 105
    history.setPreviousExtent();
105 106
    assertTrue(history.hasNext());
106 107
  }
......
118 119
		Rectangle2D rectangle2 = new Rectangle2D.Double(2, 2, 3, 3);
119 120

  
120 121
		history.put(rectangle);
121
		assertEquals(rectangle, history.getPrev());
122
		assertEquals(rectangle, history.getCurrent());
122 123

  
123 124
		history.put(rectangle2);
124
		assertEquals(rectangle2, history.getPrev());
125
		assertEquals(rectangle2, history.getCurrent());
126
		assertEquals(rectangle, history.getPrev());
125 127

  
126 128
		assertEquals(rectangle, history.setPreviousExtent());
127 129

  

Also available in: Unified diff