Modifier and Type | Field and Description |
---|---|
protected Hashtable<Integer,XcasAnnotation> |
annotations |
protected File |
f |
protected Hashtable<XcasAnnotation,String> |
positions |
Constructor and Description |
---|
XcasFile()
Default constructor.
|
XcasFile(File f)
Constructs an
XcasFile with the specified name. |
XcasFile(String f)
Constructs an
XcasFile with the specified name. |
Modifier and Type | Method and Description |
---|---|
void |
addAnnotation(int id,
XcasAnnotation a)
Inserts a new annotation with the specified internal
id
to this XcasFile . |
void |
addAnnotation(int id,
XcasAnnotation a,
int lineNum,
int colNum)
Inserts a new annotation, along with its position in the file,
to this
XcasFile object. |
void |
addAnnotation(int id,
XcasAnnotation a,
String pos)
Inserts a new annotation, along with its position in the file,
to this
XcasFile object. |
LinkedList<XcasAnnotation> |
annotationsClone() |
Object |
clone() |
boolean |
equals(Object obj)
Checks whether the specified object has the same set of annotations.
|
Collection<XcasAnnotation> |
getAllAnnotations() |
XcasAnnotation |
getAnnotation(int id)
Returns the
XcasAnnotation object associated with
the specified internal id. |
String |
getFileName() |
String |
getPosition(XcasAnnotation a)
Returns the line and column numbers of the specified
XcasAnnotation . |
String |
getPositionOther(XcasAnnotation a)
Finds an
XcasAnnotation with the same attributes as specified,
and returns its line and column numbers. |
String |
getPositionOwn(int id)
Returns the line and column numbers of the
XcasAnnotation ,
specified by the original XCAS internal _id field. |
String |
getPositionOwn(XcasAnnotation a)
Returns the line and column numbers of the specified
XcasAnnotation ,
which is included in this XcasFile object. |
String |
getPositionSimilar(XcasAnnotation a)
Finds an
XcasAnnotation of the same type as specified, and
a same text span, then returns its line and column number. |
boolean |
hasAnnotation(int id)
Checks whether this XCAS file has an annotation with the specified id.
|
boolean |
hasAnnotation(XcasAnnotation a)
Checks whether this XCAS file has the specified
XcasAnnotation . |
static XcasFile |
process(String f)
Creates a new
XcasFile object from the specified file. |
protected File f
protected Hashtable<Integer,XcasAnnotation> annotations
protected Hashtable<XcasAnnotation,String> positions
public XcasFile()
public XcasFile(String f)
XcasFile
with the specified name.f
- File name.public XcasFile(File f)
XcasFile
with the specified name.f
- A File object.public static XcasFile process(String f)
XcasFile
object from the specified file.
Avoid using this method if you plan to parse multiple files,
as this method creates an anonymous XcasProcessor
instance
each time called, which could be used to parse multiple files.f
- A string containing the XCAS file name.XcasFile
object.public void addAnnotation(int id, XcasAnnotation a)
id
to this XcasFile
.id
- UIMA CAS internal _id
.a
- An XcasAnnotation
object to add.addAnnotation(int, XcasAnnotation, String)
,
addAnnotation(int, XcasAnnotation, int, int)
public void addAnnotation(int id, XcasAnnotation a, String pos)
XcasFile
object.id
- UIMA CAS internal _id
.a
- An XcasAnnotation
object to add.pos
- Line and column number of the specified annotation,
in the form of line_number:column_number
.public void addAnnotation(int id, XcasAnnotation a, int lineNum, int colNum)
XcasFile
object.id
- UIMA CAS internal _id
.a
- An XcasAnnotation
object to add.lineNum
- Line number of the specified annotation.colNum
- Column number of the specified annotation.public XcasAnnotation getAnnotation(int id)
XcasAnnotation
object associated with
the specified internal id.id
- UIMA CAS internal _id
.XcasAnnotation
with the specified id.public Collection<XcasAnnotation> getAllAnnotations()
public String getFileName()
public String getPositionOwn(XcasAnnotation a)
XcasAnnotation
,
which is included in this XcasFile
object.line_number:column_number
.getPositionOwn(int)
,
getPositionOther(XcasAnnotation)
public String getPositionOwn(int id)
XcasAnnotation
,
specified by the original XCAS internal _id
field.id
- UIMA CAS internal _id
.line_number:column_number
.getPositionOwn(XcasAnnotation)
,
getPositionOther(XcasAnnotation)
public String getPositionOther(XcasAnnotation a)
XcasAnnotation
with the same attributes as specified,
and returns its line and column numbers.line_number:column_number
.getPositionOwn(int)
,
getPositionOwn(XcasAnnotation)
public String getPosition(XcasAnnotation a)
XcasAnnotation
.
Do not use this method if you know the specified XcasAnnotation
object is in this XcasFile
. Instead, use
getPositionOwn(XcasAnnotation)
, which is faster.
a
- Anline_number:column_number
.getPositionOwn(XcasAnnotation)
,
getPositionOther(XcasAnnotation)
public String getPositionSimilar(XcasAnnotation a)
XcasAnnotation
of the same type as specified, and
a same text span, then returns its line and column number.a
- An XcasAnnotation
against which a similar
XcasAnnotation
in this XcasFile
is to be matched.line_number:column_number
.getPositionOther(XcasAnnotation)
public boolean hasAnnotation(int id)
id
- UIMA CAS internal _id
.true
if file has an annotation with the specified id,
false
otherwise.public boolean hasAnnotation(XcasAnnotation a)
XcasAnnotation
.
If there is an XcasAnnotation
object that has exactly the same
type, attributes, and references, return true
.a
- An XcasAnnotation
to check.true
if there is one XcasAnnotation
equals
the specified one, false
otherwise.XcasAnnotation.equals(Object)
public boolean equals(Object obj)
XcasFile
object. If so, check whether
its annotation set is of the same size as in this XcasFile
, then check
whether these two sets are equal.public LinkedList<XcasAnnotation> annotationsClone()
Copyright © 2012-2017 The Apache Software Foundation. All Rights Reserved.