|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectedu.rice.cs.drjava.model.cache.DocumentCache.DocManager
private class DocumentCache.DocManager
Manages the retrieval of a document for a corresponding open definitions document. This manager only maintains its document data if it contained in _residentQueue, which is maintained using a round-robin replacement scheme.
| Field Summary | |
|---|---|
private DefinitionsDocument |
_doc
|
private HashSet<String> |
_keywords
Set of keywords if they were updated since the document had been kicked out, or null if not updated. |
private DDReconstructor |
_rec
|
private int |
_stat
|
| Constructor Summary | |
|---|---|
DocumentCache.DocManager(DDReconstructor rec,
boolean isUntitled)
Instantiates a manager for the documents that are produced by the given document reconstructor. |
|
| Method Summary | |
|---|---|
private void |
add()
Adds this DocManager to the queue and sets status to IN_QUEUE. |
void |
addDocumentListener(DocumentListener l)
Adds DocumentListener to the reconstructor. |
void |
close()
Closes the corresponding document for this adapter. |
(package private) void |
closingKickOut()
Called by the cache when the document is being closed. |
void |
documentModified()
|
void |
documentReset()
|
void |
documentSaved()
Updates status of this document in the cache. |
DefinitionsDocument |
getDocument()
Gets the physical document (DD) for this manager. |
int |
getLength()
Gets the length of this document using (i) cached _doc or (ii) reconstructor (which may force the document to be loaded. |
String |
getText()
Gets the text of this document using the cached reconstructor if document is not resident or it is unchanged. |
String |
getText(int offset,
int len)
|
boolean |
isReady()
Checks whether the document is resident (in the cache or modified). |
private boolean |
isUnmanagedOrUntitled()
All of the following private methods presume that _cacheLock is held |
(package private) void |
kickOut()
Called by the cache when the document is removed from the active queue and subject to virtualization. |
private void |
kickOut(boolean isClosing)
Performs the actual kickOut operation. |
private DefinitionsDocument |
makeDocument()
Makes this document; assumes that cacheLock is already held. |
private void |
remove()
Removes this DocManager from the queue and sets status to NOT_IN_QUEUE. |
void |
setKeywords(Set<String> keywords)
Set the specified keywords as keywords for syntax highlighting. |
String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
private final DDReconstructor _rec
private volatile HashSet<String> _keywords
private volatile int _stat
private volatile DefinitionsDocument _doc
| Constructor Detail |
|---|
public DocumentCache.DocManager(DDReconstructor rec,
boolean isUntitled)
rec - The reconstructor used to create the document| Method Detail |
|---|
public void addDocumentListener(DocumentListener l)
addDocumentListener in interface DCacheAdapterprivate DefinitionsDocument makeDocument()
public DefinitionsDocument getDocument()
throws IOException,
FileMovedException
getDocument in interface DCacheAdapterIOException
FileMovedExceptionpublic int getLength()
getLength in interface DCacheAdapterpublic String getText()
getText in interface DCacheAdapter
public String getText(int offset,
int len)
throws BadLocationException
getText in interface DCacheAdapterBadLocationExceptionpublic boolean isReady()
isReady in interface DCacheAdapterpublic void close()
close in interface DCacheAdapterpublic void documentModified()
documentModified in interface DCacheAdapterpublic void documentReset()
documentReset in interface DCacheAdapterpublic void documentSaved()
documentSaved in interface DCacheAdapterprivate void add()
private void remove()
private boolean isUnmanagedOrUntitled()
void kickOut()
void closingKickOut()
private void kickOut(boolean isClosing)
public String toString()
toString in class Objectpublic void setKeywords(Set<String> keywords)
setKeywords in interface DCacheAdapterkeywords - keywords to highlight
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||