public class DocumentRange extends java.lang.Object implements java.lang.Comparable<DocumentRange>
构造器和说明 |
---|
DocumentRange(int startOffs,
int endOffs)
Constructor.
|
限定符和类型 | 方法和说明 |
---|---|
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. |
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
在接口中 java.lang.Comparable<DocumentRange>
other
- Another document range.public boolean equals(java.lang.Object other)
equals
在类中 java.lang.Object
other
- 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
在类中 java.lang.Object
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
在类中 java.lang.Object
public DocumentRange translate(int amount)
amount
- The amount to translate this range by.