|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.ibm.richtext.textformat.TextOffset
A TextOffset indicates both an integer offset into text and a placement on one of the characters adjacent to the offset. An offset is a position between two characters; offset n is between character n-1 and character n. The placement specifies whether it is associated with the character after the offset (character n) or the character before the offset (character n-1).
Knowing which character the TextOffset is associated with is necessary when displaying carets. In bidirectional text, a single offset may have two distinct carets. Also, in multiline text, an offset at a line break has a possible caret on each line.
Most clients will not be interested in the placement, and will just use the offset.
Field Summary | |
static boolean |
AFTER_OFFSET
Indicates that the TextOffset is associated with character fOffset - ie the character after its offset. |
static boolean |
BEFORE_OFFSET
Indicates that the TextOffset is associated with character fOffset - 1 - ie the character before its offset. |
int |
fOffset
The offset into the text. |
boolean |
fPlacement
The placement - before or after. |
Constructor Summary | |
TextOffset()
Constructs a new TextOffset at 0, with placement AFTER_OFFSET. |
|
TextOffset(int offset)
Constructs a new TextOffset |
|
TextOffset(int offset,
boolean placement)
Constructs a new TextOffset with the given offset and placement. |
|
TextOffset(TextOffset rhs)
Constructs a new TextOffset from an existing one. |
Method Summary | |
void |
assign(TextOffset other)
Copy the value of another TextOffset into this |
boolean |
equals(java.lang.Object other)
Compare this to another Object. |
boolean |
equals(TextOffset other)
Return true if offset and placement are the same. |
boolean |
greaterThan(TextOffset other)
Return true if this offset is 'greaterThan' other. |
int |
hashCode()
Return the hashCode for this object. |
boolean |
lessThan(TextOffset other)
Return true if this offset is 'lessThan' other. |
void |
setOffset(int offset,
boolean placement)
Set the value of the TextOffset |
java.lang.String |
toString()
Return a string representation of this object. |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final boolean BEFORE_OFFSET
fOffset - 1
- ie the character before its offset.public static final boolean AFTER_OFFSET
fOffset
- ie the character after its offset.public int fOffset
public boolean fPlacement
Constructor Detail |
public TextOffset(int offset)
offset
- the offset into the text to represent. Placement is implicitly AFTER_OFFSET.public TextOffset()
public TextOffset(int offset, boolean placement)
offset
- the offset into the textplacement
- indicates the position of the caret; one of BEFORE_OFFSET or AFTER_OFFSETpublic TextOffset(TextOffset rhs)
ths
- the TextOffset to copyMethod Detail |
public void setOffset(int offset, boolean placement)
offset
- the offset into the textplacement
- indicates the position of the caret; one of BEFORE_OFFSET or AFTER_OFFSETpublic boolean equals(java.lang.Object other)
equals
in class java.lang.Object
public boolean equals(TextOffset other)
other
- offset to compare againstpublic int hashCode()
hashCode
in class java.lang.Object
public boolean greaterThan(TextOffset other)
other
- the other offsetpublic boolean lessThan(TextOffset other)
other
- the other offsetpublic void assign(TextOffset other)
other
- the TextOffset to copypublic java.lang.String toString()
toString
in class java.lang.Object
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |