|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectedu.northwestern.at.wordhoard.model.text.TextLocation
public class TextLocation
A text location.
A location is a line index plus a character offset within the line.
The line index is -1 if the location is above the first line, or Integer.MAX_VALUE if the location is below the last line.
The character offset is 0 if the location is above the first line or below the last line.
The character offset is -1 if the location is to the left of a line.
The character offset is Integer.MAX_VALUE if the the location is to the right of a line.
For a line of length n, offset 0 is the location preceding the first character of the line (the beginning of the line). Offset n is the location following the last character of the line (the end of the line).
| Constructor Summary | |
|---|---|
TextLocation()
Creates a new empty location. |
|
TextLocation(int index,
int offset)
Creates a new location. |
|
| Method Summary | |
|---|---|
int |
compareTo(java.lang.Object o)
Compares this location with another location. |
boolean |
equals(java.lang.Object o)
Returns true if this location is equal to another location. |
int |
getIndex()
Gets the line index. |
int |
getOffset()
Gets the character offset in the line. |
boolean |
isInText()
Returns true if the location is within the text. |
void |
setIndex(int index)
Sets the line index. |
void |
setOffset(int offset)
Sets the character offset in the line. |
java.lang.String |
toString()
Returns a string representation of the location. |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public TextLocation()
public TextLocation(int index,
int offset)
index - Line index.offset - Character offset in line. | Method Detail |
|---|
public int getIndex()
public void setIndex(int index)
index - Line index. public int getOffset()
public void setOffset(int offset)
offset - The character offset in the line. public boolean isInText()
The location is "within the text" if neither the line index nor the character offset is -1 or Integer.MAX_VALUE.
public int compareTo(java.lang.Object o)
compareTo in interface java.lang.Comparableo - The other location.
public boolean equals(java.lang.Object o)
equals in class java.lang.Objecto - The other location.
public java.lang.String toString()
toString in class java.lang.Object
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||