javax.swing.text
Class GapContent.MarkVector

java.lang.Object
  extended byjavax.swing.text.GapVector
      extended byjavax.swing.text.GapContent.MarkVector
All Implemented Interfaces:
Serializable
Enclosing class:
GapContent

static class GapContent.MarkVector
extends GapVector


Field Summary
(package private)  GapContent.MarkData[] oneMark
           
 
Constructor Summary
(package private) GapContent.MarkVector()
           
(package private) GapContent.MarkVector(int size)
           
 
Method Summary
 void addElement(GapContent.MarkData m)
          Add a mark to the end
protected  Object allocateArray(int len)
          Allocate an array to store items of the type appropriate (which is determined by the subclass).
(package private)  void close(int position, int nItems)
          Delete nItems at position.
 GapContent.MarkData elementAt(int index)
          Fetches the mark at the given index
protected  Object getArray()
          Access to the array.
protected  int getArrayLength()
          Get the length of the allocated array
protected  int getGapEnd()
          Access to the end of the gap.
protected  int getGapStart()
          Access to the start of the gap.
 void insertElementAt(GapContent.MarkData m, int index)
          Inserts a mark into the vector
(package private)  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.
protected  void replaceRange(int start, int end, Object[] marks)
          Replaces the elements in the specified range with the passed in objects.
(package private)  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.
protected  void shiftGapEndUp(int newGapEnd)
          Adjust the gap end upward.
protected  void shiftGapStartDown(int newGapStart)
          Adjust the gap end downward.
 int size()
          Returns the number of marks currently held
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

oneMark

GapContent.MarkData[] oneMark
Constructor Detail

GapContent.MarkVector

GapContent.MarkVector()

GapContent.MarkVector

GapContent.MarkVector(int size)
Method Detail

allocateArray

protected Object allocateArray(int len)
Allocate an array to store items of the type appropriate (which is determined by the subclass).

Specified by:
allocateArray in class GapVector

getArrayLength

protected int getArrayLength()
Get the length of the allocated array

Specified by:
getArrayLength in class GapVector

size

public int size()
Returns the number of marks currently held


insertElementAt

public void insertElementAt(GapContent.MarkData m,
                            int index)
Inserts a mark into the vector


addElement

public void addElement(GapContent.MarkData m)
Add a mark to the end


elementAt

public GapContent.MarkData elementAt(int index)
Fetches the mark at the given index


replaceRange

protected void replaceRange(int start,
                            int end,
                            Object[] marks)
Replaces the elements in the specified range with the passed in objects. This will NOT adjust the gap. The passed in indices do not account for the gap, they are the same as would be used int elementAt.


getArray

protected final Object getArray()
Access to the array. The actual type of the array is known only by the subclass.


getGapStart

protected final int getGapStart()
Access to the start of the gap.


getGapEnd

protected final int getGapEnd()
Access to the end of the gap.


replace

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.

Parameters:
position - the location to make the replacement. This is not the location in the underlying storage array, but the location in the contiguous space being modeled.
rmSize - the number of items to remove
addItems - the new items to place in storage.

close

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.


open

int open(int position,
         int nItems)
Make space for the given number of items at the given location.

Returns:
the location that the caller should fill in

resize

void resize(int nsize)
resize the underlying storage array to the given new size


shiftEnd

protected void shiftEnd(int newSize)
Make the gap bigger, moving any necessary data and updating the appropriate marks


shiftGap

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.


shiftGapStartDown

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).


shiftGapEndUp

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).