| java.lang.Object org.netbeans.editor.DocCache
DocCache | class DocCache (Code) | | Document cache The cache is used to perform insert/remove/read/find
operations over the document. The document data are partly stored in cache
fragments and partly in cache support. Cache can contain several
non-overlapping fragments. At all times there is one fragment called default
fragment. It's used for all operations of callers that don't pass valid
fragment information to the insert/remove and other methods.
author: Miloslav Metelka version: 1.00 |
Constructor Summary | |
public | DocCache(DocCacheSupport support, int len, boolean directMode) Create the new cache with the specified size of default fragment. |
Method Summary | |
public synchronized Fragment | addFragment(int fragLen) | public synchronized int | find(Finder finder, int startPos, int endPos, Fragment frag) Find something in the cache using specified Finder . | public synchronized void | flush() | final public synchronized int | getDocLength() Get the total length of the document. | void | initCacheContent(char initCache, int offset, int cacheLen) Set initial content of the cache. | public synchronized void | insert(int pos, char text, Fragment frag) Insert the array of chars at some position. | public synchronized void | insertString(int pos, String text, Fragment frag) Insert the string at some position. | public synchronized void | read(int pos, char ret, int offset, int len, Fragment frag) Read the data from the cache. | final public char[] | read(int pos, int len, Fragment frag) Read the data from the cache and return reults as char array. | public synchronized void | remove(int pos, int len, Fragment frag) Remove the specified count of chars from the specified position. | final void | throwPosException(int pos) | public String | toString() |
statBackOverlapCnt | public int statBackOverlapCnt(Code) | | |
statFragSetEmpty | public int statFragSetEmpty(Code) | | |
statFragSwitchCnt | public int statFragSwitchCnt(Code) | | |
statInsert | public int statInsert(Code) | | |
statOverlapCnt | public int statOverlapCnt(Code) | | |
statRead | public int statRead(Code) | | |
statReadFragCnt | public int statReadFragCnt(Code) | | |
statRemove | public int statRemove(Code) | | |
statWriteFragCnt | public int statWriteFragCnt(Code) | | |
DocCache | public DocCache(DocCacheSupport support, int len, boolean directMode)(Code) | | Create the new cache with the specified size of default fragment.
Parameters: support - CacheSupport to use for the document Parameters: len - Length of the default fragment Parameters: directMode - whether all operations should be routed to support |
addFragment | public synchronized Fragment addFragment(int fragLen)(Code) | | |
find | public synchronized int find(Finder finder, int startPos, int endPos, Fragment frag) throws BadLocationException(Code) | | Find something in the cache using specified Finder . It
covers both forward and backward searches. To do backward search, specify
endPos < startPos. The following position intervals are searched: forward
search: Parameters: finder - finder that will be used for searching Parameters: startPos - position from which search starts. For backward search thisvalue is greater or equal than endPos . Parameters: endPos - limit position of search area For backward search this valueis lower than startPos . Parameters: frag - dedicated fragment (can be null) position where the found string begins or -1 if the text was notfound |
flush | public synchronized void flush()(Code) | | Flush the whole cache to support
|
getDocLength | final public synchronized int getDocLength()(Code) | | Get the total length of the document.
|
initCacheContent | void initCacheContent(char initCache, int offset, int cacheLen)(Code) | | Set initial content of the cache. This function may be called only once,
after construction, before the data in cache are read or manipulated.
Otherwise the cache content will be damaged. The reason for using this
function is that content that's read from reader and that should be put
into support can be also put directly into cache which saves whole
support read.
Parameters: initCache - initial cache data Parameters: offset - first valid offset in initial cache Parameters: cacheLen - length of data initial cache |
insert | public synchronized void insert(int pos, char text, Fragment frag) throws BadLocationException(Code) | | Insert the array of chars at some position. It can be done in one or more
cycles.
Parameters: pos - from which position Parameters: text - text to insert Parameters: frag - dedicated fragment (can be null) |
insertString | public synchronized void insertString(int pos, String text, Fragment frag) throws BadLocationException(Code) | | Insert the string at some position. It can be done in one or more cycles.
Parameters: pos - from which position Parameters: text - text to insert Parameters: frag - dedicated fragment (can be null) |
read | public synchronized void read(int pos, char ret, int offset, int len, Fragment frag) throws BadLocationException(Code) | | Read the data from the cache. Output array must be provided.
Parameters: pos - position from which read starts Parameters: ret - char array where the data should be put. There must be enoughspace in array to hold len requested characters Parameters: offset - offset in return array where data will be written Parameters: len - len to read Parameters: frag - dedicated fragment (can be null) |
read | final public char[] read(int pos, int len, Fragment frag) throws BadLocationException(Code) | | Read the data from the cache and return reults as char array.
Parameters: pos - position from which read starts Parameters: len - len to read Parameters: frag - dedicated fragment (can be null) char array with data from document |
remove | public synchronized void remove(int pos, int len, Fragment frag) throws BadLocationException(Code) | | Remove the specified count of chars from the specified position.
Parameters: pos - position from which remove the text Parameters: len - length of the data to be removed Parameters: frag - dedicated fragment (can be null) |
|
|