public final class TextRange
extends java.lang.Object
| Constructor and Description |
|---|
TextRange(int offset,
int length)
Constructs a text range with the given offset and the given length.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
covers(int position)
Returns whether this text range covers the given position,
including the
end offset of the range. |
boolean |
equals(java.lang.Object obj) |
int |
getEndOffset()
Returns the 0-based index of the next character of this text range.
|
int |
getLength()
Returns the number of characters in this text range.
|
int |
getOffset()
Returns the 0-based index of the first character of this text range.
|
int |
hashCode() |
boolean |
isEmpty()
Returns whether this text range is empty.
|
boolean |
strictlyCovers(int position)
Returns whether this text range covers the given position,
excluding the
end offset of the range. |
java.lang.String |
toString() |
public TextRange(int offset,
int length)
offset - the given offset (0-based)length - the given length (non-negative)public int getOffset()
public int getLength()
0 for an empty range.public int getEndOffset()
getOffset() + getLength().public boolean isEmpty()
length is 0.true if this text range is empty,
and false otherwisepublic boolean strictlyCovers(int position)
end offset of the range.position - a text position (0-based)true if this text range strictly covers the given
position, and false otherwisecovers(int)public boolean covers(int position)
end offset of the range.position - a text position (0-based)true if this text range covers the given position,
and false otherwisestrictlyCovers(int)public int hashCode()
hashCode in class java.lang.Objectpublic boolean equals(java.lang.Object obj)
equals in class java.lang.Objectpublic java.lang.String toString()
toString in class java.lang.ObjectCopyright (c) 2014, 2020 1C-Soft LLC and others. Made available under the Eclipse Public License 2.0