public class DocumentRange extends java.lang.Object implements java.lang.Comparable<DocumentRange>
| Constructor and Description |
|---|
DocumentRange(int startOffs,
int endOffs)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
int |
compareTo(DocumentRange other)
Compares this document range to another.
|
boolean |
equals(java.lang.Object other)
Returns whether this document range is equal to another one.
|
int |
getEndOffset()
Gets the end offset of the range.
|
int |
getStartOffset()
Gets the starting offset of the range.
|
int |
hashCode()
Overridden simply as a best practice, since
equals(Object) is
overridden. |
boolean |
isZeroLength()
Returns whether this document range has zero length.
|
void |
set(int start,
int end)
Sets the document range.
|
java.lang.String |
toString()
Returns a string representation of this object.
|
DocumentRange |
translate(int amount)
Translates this document range by a given amount.
|
public DocumentRange(int startOffs,
int endOffs)
startOffs - The starting offset in the document, inclusive.endOffs - The ending offset in the document, exclusive.java.lang.IllegalArgumentException - If endOffs is less than
startOffs, or either argument is less than zero.public int compareTo(DocumentRange other)
compareTo in interface java.lang.Comparable<DocumentRange>other - Another document range.public boolean equals(java.lang.Object other)
equals in class java.lang.Objectother - Another object, presumably a document range.other is also a document range, and equal
to this one.public int getEndOffset()
getStartOffset()public int getStartOffset()
getEndOffset()public int hashCode()
equals(Object) is
overridden.hashCode in class java.lang.Objectpublic boolean isZeroLength()
"foo|", where the right-hand sub-expression matches empty
strings.public void set(int start,
int end)
start - The new start value, inclusive.end - The new end value, exclusive.java.lang.IllegalArgumentException - If end is less than
start, or either argument is less than zero.public java.lang.String toString()
toString in class java.lang.Objectpublic DocumentRange translate(int amount)
amount - The amount to translate this range by.