jdk/src/share/classes/javax/swing/text/StringContent.java
changeset 25193 187a455af8f8
parent 22574 7f8ce0c8c20a
equal deleted inserted replaced
25192:4e2dc0f8702d 25193:187a455af8f8
   269      * @param v the Vector to use, with a new one created on null
   269      * @param v the Vector to use, with a new one created on null
   270      * @param offset the starting offset >= 0
   270      * @param offset the starting offset >= 0
   271      * @param length the length >= 0
   271      * @param length the length >= 0
   272      * @return the set of instances
   272      * @return the set of instances
   273      */
   273      */
   274     protected Vector getPositionsInRange(Vector v, int offset,
   274     protected Vector<UndoPosRef> getPositionsInRange(Vector<UndoPosRef> v, int offset,
   275                                                       int length) {
   275                                                       int length) {
   276         int n = marks.size();
   276         int n = marks.size();
   277         int end = offset + length;
   277         int end = offset + length;
   278         Vector placeIn = (v == null) ? new Vector() : v;
   278         Vector<UndoPosRef> placeIn = (v == null) ? new Vector<>() : v;
   279         for (int i = 0; i < n; i++) {
   279         for (int i = 0; i < n; i++) {
   280             PosRec mark = marks.elementAt(i);
   280             PosRec mark = marks.elementAt(i);
   281             if (mark.unused) {
   281             if (mark.unused) {
   282                 // this record is no longer used, get rid of it
   282                 // this record is no longer used, get rid of it
   283                 marks.removeElementAt(i);
   283                 marks.removeElementAt(i);
   296      * This is meant for internal usage, and is generally not of interest
   296      * This is meant for internal usage, and is generally not of interest
   297      * to subclasses.
   297      * to subclasses.
   298      *
   298      *
   299      * @param positions the positions of the instances
   299      * @param positions the positions of the instances
   300      */
   300      */
   301     protected void updateUndoPositions(Vector positions) {
   301     protected void updateUndoPositions(Vector<UndoPosRef> positions) {
   302         for(int counter = positions.size() - 1; counter >= 0; counter--) {
   302         for(int counter = positions.size() - 1; counter >= 0; counter--) {
   303             UndoPosRef ref = (UndoPosRef)positions.elementAt(counter);
   303             UndoPosRef ref = positions.elementAt(counter);
   304             // Check if the Position is still valid.
   304             // Check if the Position is still valid.
   305             if(ref.rec.unused) {
   305             if(ref.rec.unused) {
   306                 positions.removeElementAt(counter);
   306                 positions.removeElementAt(counter);
   307             }
   307             }
   308             else
   308             else
   435         // The string that was inserted. To cut down on space needed this
   435         // The string that was inserted. To cut down on space needed this
   436         // will only be valid after an undo.
   436         // will only be valid after an undo.
   437         protected String string;
   437         protected String string;
   438         // An array of instances of UndoPosRef for the Positions in the
   438         // An array of instances of UndoPosRef for the Positions in the
   439         // range that was removed, valid after undo.
   439         // range that was removed, valid after undo.
   440         protected Vector posRefs;
   440         protected Vector<UndoPosRef> posRefs;
   441     }
   441     }
   442 
   442 
   443 
   443 
   444     /**
   444     /**
   445      * UndoableEdit created for removes.
   445      * UndoableEdit created for removes.
   492         protected int length;
   492         protected int length;
   493         // The string that was inserted. This will be null after an undo.
   493         // The string that was inserted. This will be null after an undo.
   494         protected String string;
   494         protected String string;
   495         // An array of instances of UndoPosRef for the Positions in the
   495         // An array of instances of UndoPosRef for the Positions in the
   496         // range that was removed, valid before undo.
   496         // range that was removed, valid before undo.
   497         protected Vector posRefs;
   497         protected Vector<UndoPosRef> posRefs;
   498     }
   498     }
   499 }
   499 }