Because it is immutable, it cannot track locations in the document which is being edited.
For that, use Marker.
| Modifier and Type | Field and Description |
|---|---|
| private final int | |
| private final int | |
| private final boolean | |
| private final int | |
| public static final TextPos | ZERO
A text position at the start of the document. |
| Access | Constructor and Description |
|---|---|
| public | TextPos(int
the paragraph index index, int the offset in the text which corresponds to the insertion position offset, int the character index charIndex, boolean indicates whether the position is at the leading edge of the character at leading)charIndexCreates a new text position. |
| Modifier and Type | Method and Description |
|---|---|
| public int | |
| public int | compareTo(TextPos p)
Implements java. Compares this object with the specified object for order. |
| public boolean | equals(Object x)
Overrides java. Indicates whether some other object is "equal to" this one. |
| public int | |
| public int | |
| public boolean | Returns: true if leading text positionDetermines whether the text position is leading or trailing. |
| public boolean | Returns: true if same insertion indextext position p)Returns true if the specified insertion point is the same. |
| public int | |
| public static TextPos | Returns: the instance ofTextPosthe paragraph index index, int the text offset offset)Creates a new text position at the leading edge of the character at the specified text offset. |
| public String |
| charIndex | back to summary |
|---|---|
| private final int charIndex | |
| index | back to summary |
|---|---|
| private final int index | |
| leading | back to summary |
|---|---|
| private final boolean leading | |
| offset | back to summary |
|---|---|
| private final int offset | |
| ZERO | back to summary |
|---|---|
| public static final TextPos ZERO A text position at the start of the document. | |
| TextPos | back to summary |
|---|---|
| public TextPos(int index, int offset, int charIndex, boolean leading) Creates a new text position.
| |
| charIndex | back to summary |
|---|---|
| public int charIndex() Returns the character index.
| |
| compareTo | back to summary |
|---|---|
| public int compareTo(TextPos p) Implements java. Doc from java. Compares this object with the specified object for order. Returns a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object. The implementor must ensure The implementor must also ensure that the relation is transitive:
Finally, the implementor must ensure that
| |
| equals | back to summary |
|---|---|
| public boolean equals(Object x) Overrides java. Doc from java. Indicates whether some other object is "equal to" this one.
The
An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.
| |
| hashCode | back to summary |
|---|---|
| public int hashCode() Overrides java. Doc from java. Returns a hash code value for this object. This method is
supported for the benefit of hash tables such as those provided by
The general contract of
| |
| index | back to summary |
|---|---|
| public int index() Returns the paragraph index.
| |
| isLeading | back to summary |
|---|---|
| public boolean isLeading() Determines whether the text position is leading or trailing.
| |
| isSameInsertionIndex | back to summary |
|---|---|
| public boolean isSameInsertionIndex(TextPos p) Returns true if the specified insertion point is the same.
| |
| offset | back to summary |
|---|---|
| public int offset() Returns the offset into the plain text string (insertion index).
| |
| ofLeading | back to summary |
|---|---|
| public static TextPos ofLeading(int index, int offset) Creates a new text position at the leading edge of the character at the specified text offset.
| |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Doc from java. Returns a string representation of the object.
Satisfying this method's contract implies a non-
| |