public class Span extends Object implements Serializable, Comparable<Span>
Represents a starting (inclusive) and ending (exclusive) portion of a CharSequence
.
Constructor and Description |
---|
Span(int start,
int end)
Instantiates a new Span.
|
Modifier and Type | Method and Description |
---|---|
int |
compareTo(Span o) |
boolean |
encloses(Span other)
Returns true if the bounds of the other text do not extend outside the bounds of this text.
|
int |
end()
The ending offset
|
boolean |
equals(Object other) |
int |
hashCode() |
boolean |
isEmpty()
Checks if the span is empty (
start == end ) |
int |
length()
The length of the span
|
boolean |
overlaps(Span other)
Returns true if the bounds of other text are connected with the bounds of this text.
|
int |
start()
The starting offset
|
String |
toString() |
public Span(int start, int end)
start
- the startend
- the endpublic int start()
public int end()
public int length()
public boolean isEmpty()
start == end
)public boolean overlaps(Span other)
other
- The other text to check if this one overlapspublic boolean encloses(Span other)
other
- The other text to check if this one enclosespublic int compareTo(Span o)
compareTo
in interface Comparable<Span>
Copyright © 2016. All rights reserved.