GapContent
| Modifier and Type | Field and Description |
|---|---|
| private Object | array
The array of items. |
| private int | g0
start of gap in the array |
| private int | g1
end of gap in the array |
| Access | Constructor and Description |
|---|---|
| public | |
| public | GapVector(int
the initial size initialLength)Creates a new GapVector object, with the initial size specified. |
| Modifier and Type | Method and Description |
|---|---|
| protected abstract Object | Returns: the java array of some typethe length of the array len)Allocate an array to store items of the type appropriate (which is determined by the subclass). |
| pack-priv void | |
| protected final Object | |
| protected abstract int | |
| protected final int | |
| protected final int | |
| pack-priv int | Returns: the new size of the storage arraythe size which is necessary for new content reqSize)Calculates a new size of the storage array depending on required capacity. |
| pack-priv int | Returns: the location that the caller should fill inMake space for the given number of items at the given location. |
| protected void | replace(int
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. position, int the number of items to remove rmSize, Object the new items to place in storage. addItems, int the number of items to add addSize)Replace the given logical position in the storage with the given new items. |
| pack-priv void | |
| protected void | shiftEnd(int
the new capacity newSize)Make the gap bigger, moving any necessary data and updating the appropriate marks. |
| protected void | shiftGap(int
the new start of the gap newGapStart)Move the start of the gap to a new location, without changing the size of the gap. |
| protected void | |
| protected void |
| array | back to summary |
|---|---|
| private Object array The array of items. The type is determined by the subclass. | |
| g0 | back to summary |
|---|---|
| private int g0 start of gap in the array | |
| g1 | back to summary |
|---|---|
| private int g1 end of gap in the array | |
| GapVector | back to summary |
|---|---|
| public GapVector() Creates a new GapVector object. Initial size defaults to 10. | |
| GapVector | back to summary |
|---|---|
| public GapVector(int initialLength) Creates a new GapVector object, with the initial size specified.
| |
| allocateArray | back to summary |
|---|---|
| protected abstract Object allocateArray(int len) Allocate an array to store items of the type appropriate (which is determined by the subclass).
| |
| close | back to summary |
|---|---|
| pack-priv 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. | |
| getArray | back to summary |
|---|---|
| protected final Object getArray() Access to the array. The actual type of the array is known only by the subclass.
| |
| getArrayLength | back to summary |
|---|---|
| protected abstract int getArrayLength() Get the length of the allocated array.
| |
| getGapEnd | back to summary |
|---|---|
| protected final int getGapEnd() Access to the end of the gap.
| |
| getGapStart | back to summary |
|---|---|
| protected final int getGapStart() Access to the start of the gap.
| |
| getNewArraySize | back to summary |
|---|---|
| pack-priv int getNewArraySize(int reqSize) Calculates a new size of the storage array depending on required capacity.
| |
| open | back to summary |
|---|---|
| pack-priv int open(int position, int nItems) Make space for the given number of items at the given location.
| |
| replace | back to summary |
|---|---|
| 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.
| |
| resize | back to summary |
|---|---|
| pack-priv void resize(int nsize) resize the underlying storage array to the given new size | |
| shiftEnd | back to summary |
|---|---|
| protected void shiftEnd(int newSize) Make the gap bigger, moving any necessary data and updating the appropriate marks.
| |
| shiftGap | back to summary |
|---|---|
| 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.
| |
| shiftGapEndUp | back to summary |
|---|---|
| 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).
| |
| shiftGapStartDown | back to summary |
|---|---|
| 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).
| |