Home » openjdk-7 » javax » swing » text » [javadoc | source]
javax.swing.text
abstract class: GapVector [javadoc | source]
java.lang.Object
   javax.swing.text.GapVector

All Implemented Interfaces:
    java$io$Serializable

Direct Known Subclasses:
    MarkVector, GapContent

An implementation of a gapped buffer similar to that used by emacs. The underlying storage is a java array of some type, which is known only by the subclass of this class. The array has a gap somewhere. The gap is moved to the location of changes to take advantage of common behavior where most changes occur in the same location. Changes that occur at a gap boundary are generally cheap and moving the gap is generally cheaper than moving the array contents directly to accomodate the change.
Constructor:
 public GapVector() 
 public GapVector(int initialLength) 
Method from javax.swing.text.GapVector Summary:
allocateArray,   close,   getArray,   getArrayLength,   getGapEnd,   getGapStart,   getNewArraySize,   open,   replace,   resize,   shiftEnd,   shiftGap,   shiftGapEndUp,   shiftGapStartDown
Methods from java.lang.Object:
clone,   equals,   finalize,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from javax.swing.text.GapVector Detail:
 abstract protected Object allocateArray(int len)
    Allocate an array to store items of the type appropriate (which is determined by the subclass).
  void close(int position,
    int nItems) 
    Delete nItems at position. Squeezes any marks within the deleted area to position. This moves the gap to the best place by minimizing it's overall movement. The gap must intersect the target block.
 protected final Object getArray() 
    Access to the array. The actual type of the array is known only by the subclass.
 abstract protected int getArrayLength()
    Get the length of the allocated array
 protected final int getGapEnd() 
    Access to the end of the gap.
 protected final int getGapStart() 
    Access to the start of the gap.
 int getNewArraySize(int reqSize) 
    Calculates a new size of the storage array depending on required capacity.
 int open(int position,
    int nItems) 
    Make space for the given number of items at the given location.
 protected  void replace(int position,
    int rmSize,
    Object addItems,
    int addSize) 
    Replace the given logical position in the storage with the given new items. This will move the gap to the area being changed if the gap is not currently located at the change location.
  void resize(int nsize) 
    resize the underlying storage array to the given new size
 protected  void shiftEnd(int newSize) 
    Make the gap bigger, moving any necessary data and updating the appropriate marks
 protected  void shiftGap(int newGapStart) 
    Move the start of the gap to a new location, without changing the size of the gap. This moves the data in the array and updates the marks accordingly.
 protected  void shiftGapEndUp(int newGapEnd) 
    Adjust the gap end upward. This doesn't move any data, but it does update any marks affected by the boundary change. All marks from the old gap end up to the new gap end are squeezed to the end of the gap (their location has been removed).
 protected  void shiftGapStartDown(int newGapStart) 
    Adjust the gap end downward. This doesn't move any data, but it does update any marks affected by the boundary change. All marks from the old gap start down to the new gap start are squeezed to the end of the gap (their location has been removed).