public class GapTextStore extends Object implements ITextStore
This class is not intended to be subclassed.
Constructor and Description |
---|
GapTextStore(int lowWatermark,
int highWatermark)
Creates a new empty text store using the specified low and high watermarks.
|
Modifier and Type | Method and Description |
---|---|
char |
get(int offset)
Returns the character at the specified offset.
|
String |
get(int offset,
int length)
Returns the text of the specified character range.
|
protected String |
getContentAsString()
Returns a copy of the content of this text store.
|
protected int |
getGapEndIndex()
Returns the end index of the gap managed by this text store.
|
protected int |
getGapStartIndex()
Returns the start index of the gap managed by this text store.
|
int |
getLength()
Returns number of characters stored in this text store.
|
void |
replace(int offset,
int length,
String text)
Replaces the specified character range with the given text.
|
void |
set(String text)
Sets the content to
text and removes the gap
since there are no sensible predictions about
where the next change will occur. |
public GapTextStore(int lowWatermark, int highWatermark)
lowWatermark
- if this gap is ever smaller than this, it will automatically be extendedhighWatermark
- if the gap is ever larger than this, it will automatically be shrunkenpublic char get(int offset)
ITextStore
get
in interface ITextStore
offset
- the offset in this text storepublic String get(int offset, int length)
ITextStore
get
in interface ITextStore
offset
- the offset of the rangelength
- the length of the rangepublic int getLength()
ITextStore
getLength
in interface ITextStore
public void replace(int offset, int length, String text)
ITextStore
replace(getLength(), 0, "some text")
is a valid
call and appends text to the end of the text store.replace
in interface ITextStore
offset
- the offset of the range to be replacedlength
- the number of characters to be replacedtext
- the substitution textpublic void set(String text)
text
and removes the gap
since there are no sensible predictions about
where the next change will occur.set
in interface ITextStore
text
- the new content of the text storeITextStore.set(String)
protected String getContentAsString()
protected int getGapStartIndex()
protected int getGapEndIndex()
Guidelines for using Eclipse APIs. Copyright (c) IBM Corp. and others 2000, 2006. All rights reserved.