Safe: An implementation of the AbstractDocument.Content interface
implemented using a gapped buffer similar to that used by emacs.
The underlying storage is a array of unicode characters with
a gap somewhere. The gap is moved to the location of changes
to take advantage of common behavior where most changes are
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.

The positions tracking change are also generally cheap to
maintain. The Position implementations (marks) store the array
index and can easily calculate the sequential position from
the current gap location. Changes only require update to the
the marks between the old and new gap boundaries when the gap
is moved, so generally updating the marks is pretty cheap.
The marks are stored sorted so they can be located quickly
with a binary search. This increases the cost of adding a
mark, and decreases the cost of keeping the mark updated.

getChars

Enabled: Retrieves a portion of the content. If the desired content spans
the gap, we copy the content. If the desired content does not
span the gap, the actual store is returned to avoid the copy since
it is contiguous.

resetMarksAtZero

protected void resetMarksAtZero()

Resets all the marks that have an offset of 0 to have an index of
zero as well.

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

getPositionsInRange

Returns a Vector containing instances of UndoPosRef for the
Positions in the range
offset to offset + length.
If v is not null the matching Positions are placed in
there. The vector with the resulting Positions are returned.