|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--net.sf.vex.dom.GapContent
Implementation of the Content
interface that manages
changes efficiently. Implements a buffer that keeps its free space
(the "gap") at the location of the last change. Insertions at the
start of the gap require no other chars to be moved so long as the
insertion is smaller than the gap. Deletions that end of the gap
are also very efficent. Furthermore, changes near the gap require
relatively few characters to be moved.
Constructor Summary | |
GapContent(int initialCapacity)
Class constructor. |
Method Summary | |
Position |
createPosition(int offset)
Creates a new Position object at the given initial offset. |
int |
getLength()
Return the length of the content. |
java.lang.String |
getString(int offset,
int length)
Gets a substring of the content. |
void |
insertString(int offset,
java.lang.String s)
Insert a string into the content. |
void |
remove(int offset,
int length)
Deletes the given range of characters. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public GapContent(int initialCapacity)
initialCapacity
- initial capacity of the content.Method Detail |
public Position createPosition(int offset)
createPosition
in interface Content
offset
- initial offset of the positionpublic void insertString(int offset, java.lang.String s)
insertString
in interface Content
offset
- Offset at which to insert the string.s
- String to insert.public void remove(int offset, int length)
remove
in interface Content
offset
- Offset from which characters should be deleted.length
- Number of characters to delete.public java.lang.String getString(int offset, int length)
getString
in interface Content
offset
- Offset at which the string begins.length
- Number of characters to return.public int getLength()
getLength
in interface Content
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |