|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.languagecomputer.api.text.DefaultText
public class DefaultText
Default implementation of a Text
.
Alternatively, the Text
interface may be implemented in order
to be backed by a different mechanism (i.e., for speed and/or memory
performance based on the individual system).
Constructor Summary | |
---|---|
|
DefaultText()
Creates a new DefaultText . |
protected |
DefaultText(AnnotationType annType)
Subclass-only constructor to create a DefaultText with a
specific AnnotationType . |
Method Summary | ||
---|---|---|
AnnotationType |
getAnnotationType()
Returns the AnnotationType that describes this Text . |
|
|
getCongruentAnnotations(AnnotationType<T> type)
Returns all the annotations congruent with this Text that
correspond to the given AnnotationType . |
|
Document |
getDocument()
Returns the Document in which this Text exists. |
|
String |
getDocumentID()
Returns the Document ID that identifies this Text . |
|
int |
getEndCharOffset()
Returns the (exclusive) end character offset for this Text
object within the (processed) Document . |
|
|
getIntersectingAnnotations(AnnotationType<T> type)
Returns all the annotations that intersect this Text and
correspond to the given AnnotationType . |
|
String |
getRawString()
Returns the raw String value that this Text
spans. |
|
int |
getStartCharOffset()
Returns the start character offset for this Text object within
the (processed) Document . |
|
|
getSubAnnotations(AnnotationType<T> type)
Returns all the annotations within this Text that correspond
to the given AnnotationType . |
|
|
getSuperAnnotations(AnnotationType<T> type)
Returns all the annotations that contain this Text as a
subspan and correspond to the given AnnotationType . |
|
void |
setAnnotationType(AnnotationType annType)
Sets the AnnotationType . |
|
void |
setDocument(Document document)
Sets the Document without adding this DefaultText to
it. |
|
void |
setEndCharOffset(int endCharOffset)
Sets the end character offset. |
|
void |
setRawString(String rawString)
Sets the raw string, Not necessary for non- Document s. |
|
void |
setStartCharOffset(int startCharOffset)
Sets the start character offset. |
|
String |
toString()
Returns a String representation of a DefaultText . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public DefaultText()
DefaultText
.
protected DefaultText(AnnotationType annType)
DefaultText
with a
specific AnnotationType
. Use setAnnotationType(com.languagecomputer.api.text.AnnotationType)
instead
of this constructor for non-subclass constructor calls.
annType
- AnnotationType
to use for this subclass of
DefaultText
.Method Detail |
---|
public void setAnnotationType(AnnotationType annType)
AnnotationType
.
annType
- AnnotationType
to use for this
DefaultText
.Text.getAnnotationType()
,
AnnotationType
public AnnotationType getAnnotationType()
AnnotationType
that describes this Text
.
getAnnotationType
in interface Text
AnnotationType
of this Text
.AnnotationType
public String getDocumentID()
Document
ID that identifies this Text
.
getDocumentID
in interface Text
Document
that contains this
Text
.public void setDocument(Document document)
Document
without adding this DefaultText
to
it. To attach this DefaultText
to the Document
,
use DefaultDocument.addAnnotation(com.languagecomputer.api.text.Text)
instead.
document
- The Document
to use for this
DefaultText
.Text.getDocument()
public Document getDocument()
Document
in which this Text
exists.
getDocument
in interface Text
Document
that contains this Text
.public void setStartCharOffset(int startCharOffset)
startCharOffset
- The start character offset to use for this
DefaultText
.Text.getStartCharOffset()
public int getStartCharOffset()
Text
object within
the (processed) Document
. This offset does not necessarily line up
with the start character offset from the unprocessed document/file.
getStartCharOffset
in interface Text
public void setEndCharOffset(int endCharOffset)
endCharOffset
- The end character offset to use for this
DefaultText
.Text.getEndCharOffset()
public int getEndCharOffset()
Text
object within the (processed) Document
. This offset does not
necessarily line up with the start character offset from the unprocessed
document/file.
getEndCharOffset
in interface Text
public void setRawString(String rawString)
Document
s.
The start and end character offsets can be used to determine the raw
string for a DefaultText
. Allowed to be overriden for system
flexibility.
rawString
- The raw String
to use for this
DefaultText
.Text.getRawString()
public String getRawString()
String
value that this Text
spans. Includes whitespace (spaces, tabs, newlines, etc) but not the
original markup (html tags, pdf and MS word markup, etc). Might contain
additional newlines along paragraph boundaries for some large documents.
getRawString
in interface Text
public <T extends Text> Collection<T> getCongruentAnnotations(AnnotationType<T> type)
Text
that
correspond to the given AnnotationType
.
getCongruentAnnotations
in interface Text
T
- The Text
sub-class corresponding to the given
AnnotationType
.type
- The AnnotationType
that all returned items will match.
Collection
of objects matching the given
AnnotationType
. The annotations will be in a semi-sorted
order. This means that non-intersecting objects will be sorted
by their order in the document. No guarantee will be placed on the
order of intersecting objects.public <T extends Text> Collection<T> getSubAnnotations(AnnotationType<T> type)
Text
that correspond
to the given AnnotationType
.
getSubAnnotations
in interface Text
T
- The Text
sub-class corresponding to the given
AnnotationType
.type
- The AnnotationType
that all returned items will match.
Collection
of objects matching the given
AnnotationType
. The annotations will be in a semi-sorted
order. This means that non-intersecting objects will be sorted
by their order in the document. No guarantee will be placed on the
order of intersecting objects.public <T extends Text> Collection<T> getSuperAnnotations(AnnotationType<T> type)
Text
as a
subspan and correspond to the given AnnotationType
.
getSuperAnnotations
in interface Text
T
- The Text
sub-class corresponding to the given
AnnotationType
.type
- The AnnotationType
that all returned items will match.
Collection
of objects matching the given
AnnotationType
. The annotations will be in a semi-sorted
order. This means that non-intersecting objects will be sorted
by their order in the document. No guarantee will be placed on the
order of intersecting objects.public <T extends Text> Collection<T> getIntersectingAnnotations(AnnotationType<T> type)
Text
and
correspond to the given AnnotationType
.
getIntersectingAnnotations
in interface Text
T
- The Text
sub-class corresponding to the given
AnnotationType
.type
- The AnnotationType
that all returned items will match.
Collection
of objects matching the given
AnnotationType
. The annotations will be in a semi-sorted
order. This means that non-intersecting objects will be sorted
by their order in the document. No guarantee will be placed on the
order of intersecting objects.public String toString()
String
representation of a DefaultText
.
toString
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |