|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.bluemarsh.jswat.view.SourceContent
Class SourceContent holds the content for a source view.
Field Summary | |
protected int |
lineCount
Number of lines in content. |
protected int[] |
lineEndOffset
Array of end-of-line offsets. |
protected int[] |
lineEndSize
Array of end-of-line sizes. |
protected int[] |
lineStartOffset
Array of start-of-line offsets. |
protected int |
longestLineLength
Length in characters of the longest line. |
protected char[] |
textBuffer
The text buffer, sized to fit. |
Constructor Summary | |
SourceContent(char[] buf)
Constructs a SourceContent. |
Method Summary | |
protected void |
addLineOffset(int start,
int eolsize)
Add another entry into the offset array. |
void |
dump(java.io.PrintStream out)
Prints diagnostic information to the given output stream. |
protected void |
findLines(char[] text)
Determines the line information. |
char[] |
getBuffer()
Returns the actual character buffer. |
int |
getLength()
Returns the length of this content, in characters. |
int |
getLineCount()
Returns the number of lines in this content. |
int |
getLineEndOffset(int line)
Get the offset of the end of the given line. |
int |
getLineOfOffset(int offset)
Find the line containing the given offset. |
int |
getLineRealEndOffset(int line)
Get the offset of the end of the given line, not counting the end-of-line characters themselves. |
int |
getLineStartOffset(int line)
Get the offset of the start of the given line. |
int |
getLongestLineLength()
Returns the length in characters of the longest line in this content object. |
static void |
main(java.lang.String[] args)
Test-wrapper for this class. |
static char[] |
replaceTabs(char[] str,
int tabWidth)
Find and replace tabs with spaces. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected int[] lineStartOffset
protected int[] lineEndOffset
protected int[] lineEndSize
protected int lineCount
protected char[] textBuffer
protected int longestLineLength
Constructor Detail |
public SourceContent(char[] buf)
buf
- array of text, sized to fit (may be null).Method Detail |
protected void addLineOffset(int start, int eolsize)
start
- start-of-line offset to add.eolsize
- number of end-of-line characters (1 or 2).public void dump(java.io.PrintStream out)
out
- stream to dump to.protected void findLines(char[] text)
text
- the text to analyze.public int getLength()
public int getLineCount()
public int getLineEndOffset(int line) throws javax.swing.text.BadLocationException
line
- zero-based line for which to find the end.javax.swing.text.BadLocationException
- Thrown if line is invalid.public int getLineRealEndOffset(int line) throws javax.swing.text.BadLocationException
line
- zero-based line for which to find the end.javax.swing.text.BadLocationException
- Thrown if line is invalid.public int getLineOfOffset(int offset) throws javax.swing.text.BadLocationException
offset
- offset within content >= 0.javax.swing.text.BadLocationException
- Thrown if offset is invalid.public int getLineStartOffset(int line) throws javax.swing.text.BadLocationException
line
- zero-based line for which to find the start.javax.swing.text.BadLocationException
- Thrown if line is invalid.public int getLongestLineLength()
public char[] getBuffer()
public static char[] replaceTabs(char[] str, int tabWidth)
str
- string on which to operate.tabWidth
- width of tabs.public static void main(java.lang.String[] args)
args
- command-line arguments.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |