315
316 // --- variables --------------------------------------
317
318 private static final char[] empty = new char[0];
319 private transient MarkVector marks;
320
321 /**
322 * Record used for searching for the place to
323 * start updating mark indexs when the gap
324 * boundaries are moved.
325 */
326 private transient MarkData search;
327
328 /**
329 * The number of unused mark entries
330 */
331 private transient int unusedMarks = 0;
332
333 private transient ReferenceQueue<StickyPosition> queue;
334
335 final static int GROWTH_SIZE = 1024 * 512;
336
337 // --- gap management -------------------------------
338
339 /**
340 * Make the gap bigger, moving any necessary data and updating
341 * the appropriate marks
342 */
343 protected void shiftEnd(int newSize) {
344 int oldGapEnd = getGapEnd();
345
346 super.shiftEnd(newSize);
347
348 // Adjust marks.
349 int dg = getGapEnd() - oldGapEnd;
350 int adjustIndex = findMarkAdjustIndex(oldGapEnd);
351 int n = marks.size();
352 for (int i = adjustIndex; i < n; i++) {
353 MarkData mark = marks.elementAt(i);
354 mark.index += dg;
355 }
|
315
316 // --- variables --------------------------------------
317
318 private static final char[] empty = new char[0];
319 private transient MarkVector marks;
320
321 /**
322 * Record used for searching for the place to
323 * start updating mark indexs when the gap
324 * boundaries are moved.
325 */
326 private transient MarkData search;
327
328 /**
329 * The number of unused mark entries
330 */
331 private transient int unusedMarks = 0;
332
333 private transient ReferenceQueue<StickyPosition> queue;
334
335 static final int GROWTH_SIZE = 1024 * 512;
336
337 // --- gap management -------------------------------
338
339 /**
340 * Make the gap bigger, moving any necessary data and updating
341 * the appropriate marks
342 */
343 protected void shiftEnd(int newSize) {
344 int oldGapEnd = getGapEnd();
345
346 super.shiftEnd(newSize);
347
348 // Adjust marks.
349 int dg = getGapEnd() - oldGapEnd;
350 int adjustIndex = findMarkAdjustIndex(oldGapEnd);
351 int n = marks.size();
352 for (int i = adjustIndex; i < n; i++) {
353 MarkData mark = marks.elementAt(i);
354 mark.index += dg;
355 }
|