public class Span extends SpanNode
Modifier and Type | Class and Description |
---|---|
private class |
Span.EmptyIterator |
Modifier and Type | Field and Description |
---|---|
private int |
from |
static byte |
ID |
private int |
length |
Constructor and Description |
---|
Span()
WARNING! Only to be used by deserializers! Creates an empty Span instance.
|
Span(int from,
int length)
This will construct a valid span or throw
IllegalArgumentException
if the span is invalid. |
Span(Span spanToCopy)
Copies the given Span into a new Span instance.
|
Span(SpanNodeReader reader)
Creates an empty Span, used mainly for deserialization.
|
Modifier and Type | Method and Description |
---|---|
ListIterator<SpanNode> |
childIterator()
Returns a ListIterator that iterates over absolutely nothing.
|
ListIterator<SpanNode> |
childIteratorRecursive()
Returns a ListIterator that iterates over absolutely nothing.
|
int |
getFrom()
Returns the character index where this SpanNode starts (inclusive).
|
int |
getLength()
Returns the length of this span, i.e. getFrom() - getTo().
|
CharSequence |
getText(CharSequence text)
Returns the text that is covered by this SpanNode.
|
int |
getTo()
Returns the character index where this SpanNode ends (exclusive).
|
boolean |
isLeafNode()
Always returns true.
|
void |
setFrom(int from)
NOTE: DO NOT USE.
|
void |
setLength(int length)
NOTE: DO NOT USE.
|
String |
toString() |
annotate, annotate, annotate, annotate, annotate, compareTo, contains, equals, getParent, getScratchId, getSpanTree, getStringFieldValue, hashCode, isValid, overlaps, setInvalid, setParent, setScratchId
public static final byte ID
private int from
private int length
public Span(int from, int length)
IllegalArgumentException
if the span is invalid.from
- Start of the span. Must be >= 0.length
- of the span. Must be >= 0.IllegalArgumentException
- if illegal spanpublic Span(SpanNodeReader reader)
reader
- the reader that must populate this Span instancepublic Span()
public Span(Span spanToCopy)
spanToCopy
- the Span to copy.public final int getFrom()
SpanNode
public void setFrom(int from)
SpanNodeReader
.from
- the from value to setpublic final int getTo()
SpanNode
public final int getLength()
SpanNode
public void setLength(int length)
SpanNodeReader
.length
- the length value to setpublic final CharSequence getText(CharSequence text)
SpanNode
public boolean isLeafNode()
isLeafNode
in class SpanNode
public ListIterator<SpanNode> childIterator()
childIterator
in class SpanNode
public ListIterator<SpanNode> childIteratorRecursive()
childIteratorRecursive
in class SpanNode
Copyright © 2017. All rights reserved.