Package com.yahoo.document.annotation
Class Span
java.lang.Object
com.yahoo.document.annotation.SpanNode
com.yahoo.document.annotation.Span
- All Implemented Interfaces:
SpanNodeParent,Comparable<SpanNode>
This class represents a range of characters from a string. This is the leaf node
in a Span tree. Its boundaries are defined as inclusive-from and exclusive-to.
- Author:
- baldersheim, Einar M R Rosenvinge
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionSpan()WARNING!Span(int from, int length) This will construct a valid span or throwIllegalArgumentExceptionif the span is invalid.Copies the given Span into a new Span instance.Span(SpanNodeReader reader) Creates an empty Span, used mainly for deserialization. -
Method Summary
Modifier and TypeMethodDescriptionReturns a ListIterator that iterates over absolutely nothing.Returns a ListIterator that iterates over absolutely nothing.final intgetFrom()Returns the character index where this SpanNode starts (inclusive).final intReturns the length of this span, i.e. getFrom() - getTo().final CharSequencegetText(CharSequence text) Returns the text that is covered by this SpanNode.final intgetTo()Returns the character index where this SpanNode ends (exclusive).booleanAlways returns true.voidsetFrom(int from) NOTE: DO NOT USE.voidsetLength(int length) NOTE: DO NOT USE.toString()Methods inherited from class com.yahoo.document.annotation.SpanNode
annotate, annotate, annotate, annotate, annotate, compareTo, contains, equals, getParent, getScratchId, getSpanTree, getStringFieldValue, hashCode, isValid, overlaps, setScratchId
-
Field Details
-
ID
public static final byte ID- See Also:
-
-
Constructor Details
-
Span
public Span(int from, int length) This will construct a valid span or throwIllegalArgumentExceptionif the span is invalid.- Parameters:
from- Start of the span. Must be >= 0.length- of the span. Must be >= 0.- Throws:
IllegalArgumentException- if illegal span
-
Span
Creates an empty Span, used mainly for deserialization.- Parameters:
reader- the reader that must populate this Span instance
-
Span
public Span()WARNING! Only to be used by deserializers! Creates an empty Span instance. -
Span
Copies the given Span into a new Span instance.- Parameters:
spanToCopy- the Span to copy.
-
-
Method Details
-
getFrom
public final int getFrom()Description copied from class:SpanNodeReturns the character index where this SpanNode starts (inclusive). -
setFrom
public void setFrom(int from) NOTE: DO NOT USE. Should only be used bySpanNodeReader.- Parameters:
from- the from value to set
-
getTo
public final int getTo()Description copied from class:SpanNodeReturns the character index where this SpanNode ends (exclusive). -
getLength
public final int getLength()Description copied from class:SpanNodeReturns the length of this span, i.e. getFrom() - getTo(). -
setLength
public void setLength(int length) NOTE: DO NOT USE. Should only be used bySpanNodeReader.- Parameters:
length- the length value to set
-
toString
-
getText
Description copied from class:SpanNodeReturns the text that is covered by this SpanNode. -
isLeafNode
public boolean isLeafNode()Always returns true.- Specified by:
isLeafNodein classSpanNode- Returns:
- always true.
-
childIterator
Returns a ListIterator that iterates over absolutely nothing.- Specified by:
childIteratorin classSpanNode- Returns:
- a ListIterator that iterates over absolutely nothing.
-
childIteratorRecursive
Returns a ListIterator that iterates over absolutely nothing.- Specified by:
childIteratorRecursivein classSpanNode- Returns:
- a ListIterator that iterates over absolutely nothing.
-