protected static class Editor.Line
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private boolean |
newLine
true if instance was created for '\n' in the source text. |
private int |
start
Initial character index in the source text.
|
private java.lang.String |
text
Line text.
|
private int[] |
widths
The intermediate widths (char by char) for this line; index 0 is for char 1, index 1 is
for chars 1 and 2, etc
|
Constructor and Description |
---|
Line(char[] text,
int start,
int length,
boolean newLine)
Construct an instance from given character array, offset and length.
|
Line(java.lang.String text,
int start,
boolean newLine)
Construct an instance for given string and offset.
|
Modifier and Type | Method and Description |
---|---|
int |
getOffset()
Return the offset of this instance in the source text.
|
java.lang.String |
getText()
Return text.
|
int[] |
getWidths()
Get the widths for these metrics.
|
boolean |
isNewLine()
Return
true if instance represents the text with the '\n' at the end. |
int |
length()
Get text length.
|
void |
setNewLine(boolean value)
Set 'newLine' attribute
|
void |
setOffset(int value)
Set the offset of this instance in the source text.
|
void |
setWidths(int[] widths)
Set the widths for these metrics.
|
private int start
private final java.lang.String text
private boolean newLine
true
if instance was created for '\n' in the source text.private int[] widths
public Line(char[] text, int start, int length, boolean newLine)
text
- Source character array.start
- Initial character offset.length
- Line length.newLine
- true
means that instance will is created for
the text line with '\n' at the end. The character itself
should not be included into length
parameter.public Line(java.lang.String text, int start, boolean newLine)
text
- Source string.start
- Initial offset.newLine
- true
means that instance will is created for
the text line with '\n' at the end.public int[] getWidths()
public void setWidths(int[] widths)
widths
- The intermediate char-by-char widths for the entire line. Index 0 is for
char 1, index 1 is for chars 1 and 2, and so on.public boolean isNewLine()
true
if instance represents the text with the '\n' at the end.public void setNewLine(boolean value)
value
- new value of the 'newLine' attributepublic int length()
public java.lang.String getText()
public int getOffset()
public void setOffset(int value)
value
- new offset value