| edu.rice.cs.drjava.model.DJDocument
All known Subclasses: edu.rice.cs.drjava.model.AbstractDJDocument,
DJDocument | public interface DJDocument extends SwingDocumentInterface(Code) | | Interface to be collectively shared by the Definitions Document, Open Definitions Document,
and the Interactions Document. Collectively represents a DrJava Document
|
Method Summary | |
public void | acquireReadLock() Swing-style acquireReadLock(). | public void | acquireWriteLock() Swing-style writeLock(). | public int | balanceBackward() Forwarding method to find the match for the closing brace
immediately to the left, assuming there is such a brace. | public int | balanceForward() Forwarding method to find the match for the open brace
immediately to the right, assuming there is such a brace. | public void | clear() Clears the entire text of the document. | public boolean | findCharInStmtBeforePos(char findChar, int position) This function finds the given character in the same statement as the given
position, and before the given position. | public int | findCharOnLine(int pos, char findChar) Determines if the given character exists on the line where
the given cursor position is. | public int | findNextEnclosingBrace(int pos, char opening, char closing) Searching forwards, finds the position of the enclosing brace. | public int | findPrevCharPos(int pos, char[] whitespace) Finds the position of the first non-whitespace character before pos. | public int | findPrevDelimiter(int pos, char[] delims) Searching backwards, finds the position of the first character that is one
of the given delimiters. | public int | findPrevDelimiter(int pos, char[] delims, boolean skipParenPhrases) Searching backwards, finds the position of the first character that is one
of the given delimiters. | public int | findPrevEnclosingBrace(int pos, char opening, char closing) Searching backwards, finds the position of the enclosing brace. | public int | findPrevNonWSCharPos(int pos) | public int | getCurrentLocation() Get the current location of the cursor in the document. | public int | getFirstNonWSCharPos(int pos) Finds the position of the first non-whitespace character after pos. | public int | getFirstNonWSCharPos(int pos, boolean acceptComments) Similar to the single-argument version, but allows including comments. | public int | getFirstNonWSCharPos(int pos, char[] whitespace, boolean acceptComments) Finds the position of the first non-whitespace character after pos. | public Vector<HighlightStatus> | getHighlightStatus(int start, int end) Return all highlight status info for text between start and end. | public int | getIndent() Gets the indent level. | public IndentInfo | getIndentInformation() Returns the indent information for the current location. | public String | getIndentOfCurrStmt(int pos) Returns the indent level of the start of the statement
that the cursor is on. | public String | getIndentOfCurrStmt(int pos, char[] delims) Returns the indent level of the start of the statement
that the cursor is on. | public String | getIndentOfCurrStmt(int pos, char[] delims, char[] whitespace) Returns the indent level of the start of the statement
that the cursor is on. | public int | getIntelligentBeginLinePos(int currPos) Returns the "intelligent" beginning of line. | public int | getLineEndPos(int pos) Returns the absolute position of the end of the current
line. | public int | getLineFirstCharPos(int pos) Returns the absolute position of the first non-whitespace character
on the current line. | public int | getLineStartPos(int pos) Returns the absolute position of the beginning of the
current line. | public ReducedModelState | getStateAtCurrent() | public String | getText() Gets the entire text of the document. | public int | getWhiteSpace() Gets the number of whitespace characters between the current location and the rest of the document or the
first non-whitespace character, whichever comes first. | public void | indentLines(int selStart, int selEnd) Default indentation - uses OTHER flag and no progress indicator. | public void | indentLines(int selStart, int selEnd, Indenter.IndentReason reason, ProgressMonitor pm) Parameterized indentation for special-case handling. | public void | insertString(int offset, String str, AttributeSet a) Inserts a string of text into the document. | public void | move(int dist) The actual cursor movement logic. | public boolean | posInParenPhrase(int pos) Returns true if the given position is inside a paren phrase. | public boolean | posInParenPhrase() Returns true if the reduced model's current position is inside a paren phrase. | public void | releaseReadLock() Swing-style releaseReadLock(). | public void | releaseWriteLock() Swing-style writeUnlock(). | public void | remove(int offset, int len) Removes a block of text from the specified location. | public void | resetReducedModelLocation() | public void | setCurrentLocation(int loc) | public void | setIndent(int indent) Set the indent to a particular number of spaces. | public void | setTab(String tab, int pos) Sets text between previous newline and first non-whitespace character of the line containing pos to tab. | public ReducedModelState | stateAtRelLocation(int dist) |
acquireReadLock | public void acquireReadLock()(Code) | | Swing-style acquireReadLock().
|
acquireWriteLock | public void acquireWriteLock()(Code) | | Swing-style writeLock().
|
balanceBackward | public int balanceBackward()(Code) | | Forwarding method to find the match for the closing brace
immediately to the left, assuming there is such a brace.
the relative distance backwards to the offset beforethe matching brace. |
balanceForward | public int balanceForward()(Code) | | Forwarding method to find the match for the open brace
immediately to the right, assuming there is such a brace.
the relative distance forwards to the offset afterthe matching brace. |
clear | public void clear()(Code) | | Clears the entire text of the document. Without this operation, a client must use locking to perform this
task safely.
|
findCharInStmtBeforePos | public boolean findCharInStmtBeforePos(char findChar, int position)(Code) | | This function finds the given character in the same statement as the given
position, and before the given position. It is used by QuestionExistsCharInStmt and
QuestionExistsCharInPrevStmt
|
findCharOnLine | public int findCharOnLine(int pos, char findChar)(Code) | | Determines if the given character exists on the line where
the given cursor position is. Does not search in quotes or comments.
Does not work if character being searched for is a '/' or a '*'
Parameters: pos - Cursor position Parameters: findChar - Character to search for true if this node's rule holds. |
findNextEnclosingBrace | public int findNextEnclosingBrace(int pos, char opening, char closing) throws BadLocationException(Code) | | Searching forwards, finds the position of the enclosing brace.
NB: ignores comments.
Parameters: pos - Position to start from Parameters: opening - opening brace character Parameters: closing - closing brace character position of enclosing squiggly brace, or ERROR_INDEX if beginningof document is reached. |
findPrevCharPos | public int findPrevCharPos(int pos, char[] whitespace) throws BadLocationException(Code) | | Finds the position of the first non-whitespace character before pos.
NB: Skips comments and all whitespace, including newlines
Parameters: pos - Position to start from Parameters: whitespace - chars considered as white space position of first non-whitespace character before pos,or ERROR_INDEX if begining of document is reached |
findPrevDelimiter | public int findPrevDelimiter(int pos, char[] delims) throws BadLocationException(Code) | | Searching backwards, finds the position of the first character that is one
of the given delimiters. Does not look for delimiters inside paren phrases.
(eg. skips semicolons used inside for statements.)
NB: ignores comments.
Parameters: pos - Position to start from Parameters: delims - array of characters to search for position of first matching delimiter, or ERROR_INDEX if beginningof document is reached. |
findPrevDelimiter | public int findPrevDelimiter(int pos, char[] delims, boolean skipParenPhrases) throws BadLocationException(Code) | | Searching backwards, finds the position of the first character that is one
of the given delimiters. Will not look for delimiters inside a paren
phrase if skipParenPhrases is true.
NB: ignores comments.
Parameters: pos - Position to start from Parameters: delims - array of characters to search for Parameters: skipParenPhrases - whether to look for delimiters inside paren phrases(eg. semicolons in a for statement) position of first matching delimiter, or ERROR_INDEX if beginningof document is reached. |
findPrevEnclosingBrace | public int findPrevEnclosingBrace(int pos, char opening, char closing) throws BadLocationException(Code) | | Searching backwards, finds the position of the enclosing brace.
NB: ignores comments.
Parameters: pos - Position to start from Parameters: opening - opening brace character Parameters: closing - closing brace character position of enclosing squiggly brace, or ERROR_INDEX if beginningof document is reached. |
getCurrentLocation | public int getCurrentLocation()(Code) | | Get the current location of the cursor in the document.
Unlike the usual swing document model, which is stateless, because of our implementation
of the underlying reduced model, we need to keep track of the current location.
where the cursor is as the number of characters into the document |
getFirstNonWSCharPos | public int getFirstNonWSCharPos(int pos) throws BadLocationException(Code) | | Finds the position of the first non-whitespace character after pos.
NB: Skips comments and all whitespace, including newlines
Parameters: pos - Position to start from position of first non-whitespace character after pos,or ERROR_INDEX if end of document is reached |
getFirstNonWSCharPos | public int getFirstNonWSCharPos(int pos, boolean acceptComments) throws BadLocationException(Code) | | Similar to the single-argument version, but allows including comments.
Parameters: pos - Position to start from Parameters: acceptComments - if true, find non-whitespace chars in comments position of first non-whitespace character after pos,or ERROR_INDEX if end of document is reached |
getFirstNonWSCharPos | public int getFirstNonWSCharPos(int pos, char[] whitespace, boolean acceptComments) throws BadLocationException(Code) | | Finds the position of the first non-whitespace character after pos.
NB: Skips comments and all whitespace, including newlines
Parameters: pos - Position to start from Parameters: whitespace - array of whitespace chars to ignore Parameters: acceptComments - if true, find non-whitespace chars in comments position of first non-whitespace character after pos,or ERROR_INDEX if end of document is reached |
getHighlightStatus | public Vector<HighlightStatus> getHighlightStatus(int start, int end)(Code) | | Return all highlight status info for text between start and end.
This should collapse adjoining blocks with the same status into one.
|
getIndent | public int getIndent()(Code) | | Gets the indent level.
the indent level |
getIndentInformation | public IndentInfo getIndentInformation()(Code) | | Returns the indent information for the current location.
|
getIndentOfCurrStmt | public String getIndentOfCurrStmt(int pos) throws BadLocationException(Code) | | Returns the indent level of the start of the statement
that the cursor is on. Uses a default set of delimiters.
(';', '{', '}') and a default set of whitespace characters
(' ', '\t', n', ',')
Parameters: pos - Cursor position |
getIndentOfCurrStmt | public String getIndentOfCurrStmt(int pos, char[] delims) throws BadLocationException(Code) | | Returns the indent level of the start of the statement
that the cursor is on. Uses a default set of whitespace characters.
(' ', '\t', '\n', ',')
Parameters: pos - Cursor position |
getIndentOfCurrStmt | public String getIndentOfCurrStmt(int pos, char[] delims, char[] whitespace) throws BadLocationException(Code) | | Returns the indent level of the start of the statement
that the cursor is on.
Parameters: pos - Cursor position Parameters: delims - Delimiter characters denoting end of statement Parameters: whitespace - characters to skip when looking for beginning of next statement |
getIntelligentBeginLinePos | public int getIntelligentBeginLinePos(int currPos) throws BadLocationException(Code) | | Returns the "intelligent" beginning of line. If currPos is to
the right of the first non-whitespace character, the position of the
first non-whitespace character is returned. If currPos is at or
to the left of the first non-whitespace character, the beginning of
the line is returned.
Parameters: currPos - A position on the current line |
getLineEndPos | public int getLineEndPos(int pos)(Code) | | Returns the absolute position of the end of the current
line. (At the next newline, or the end of the document.)
Parameters: pos - Any position on the current line position of the end of this line |
getLineFirstCharPos | public int getLineFirstCharPos(int pos) throws BadLocationException(Code) | | Returns the absolute position of the first non-whitespace character
on the current line.
NB: Doesn't ignore comments.
Parameters: pos - position on the line position of first non-whitespace character on this line, or the endof the line if no non-whitespace character is found. |
getLineStartPos | public int getLineStartPos(int pos)(Code) | | Returns the absolute position of the beginning of the
current line. (Just after most recent newline, or DOCSTART)
Doesn't ignore comments.
Parameters: pos - Any position on the current line position of the beginning of this line |
getText | public String getText()(Code) | | Gets the entire text of the document. Without this operation, a client must use locking to perform this
task safely.
|
getWhiteSpace | public int getWhiteSpace()(Code) | | Gets the number of whitespace characters between the current location and the rest of the document or the
first non-whitespace character, whichever comes first.
the number of whitespace characters |
indentLines | public void indentLines(int selStart, int selEnd)(Code) | | Default indentation - uses OTHER flag and no progress indicator.
Parameters: selStart - the offset of the initial character of the region to indent Parameters: selEnd - the offset of the last character of the region to indent |
indentLines | public void indentLines(int selStart, int selEnd, Indenter.IndentReason reason, ProgressMonitor pm) throws OperationCanceledException(Code) | | Parameterized indentation for special-case handling.
Parameters: selStart - the offset of the initial character of the region to indent Parameters: selEnd - the offset of the last character of the region to indent Parameters: reason - a flag from edu.rice.cs.drjava.model.definitions.indent.Indenter Indenterto indicate the reason for the indent (indent logic may vary slightly based on the trigger action) Parameters: pm - used to display progress, null if no reporting is desired |
move | public void move(int dist)(Code) | | The actual cursor movement logic. Helper for setCurrentLocation(int).
Parameters: dist - the distance from the current location to the new location. |
posInParenPhrase | public boolean posInParenPhrase(int pos)(Code) | | Returns true if the given position is inside a paren phrase.
Parameters: pos - the position we're looking at true if pos is immediately inside parentheses |
posInParenPhrase | public boolean posInParenPhrase()(Code) | | Returns true if the reduced model's current position is inside a paren phrase.
true if pos is immediately inside parentheses |
releaseReadLock | public void releaseReadLock()(Code) | | Swing-style releaseReadLock().
|
releaseWriteLock | public void releaseWriteLock()(Code) | | Swing-style writeUnlock().
|
resetReducedModelLocation | public void resetReducedModelLocation()(Code) | | |
setCurrentLocation | public void setCurrentLocation(int loc)(Code) | | Change the current location of the document
Parameters: loc - the new absolute location |
setIndent | public void setIndent(int indent)(Code) | | Set the indent to a particular number of spaces.
Parameters: indent - the size of indent that you want for the document |
setTab | public void setTab(String tab, int pos)(Code) | | Sets text between previous newline and first non-whitespace character of the line containing pos to tab.
Parameters: tab - String to be placed between previous newline and first non-whitespace character |
|
|