//get low level CAS
LowLevelCAS ll_cas = aCAS.getLowLevelCAS();
//get low level TypeSystem
LowLevelTypeSystem ll_typeSystem = ll_cas.ll_getTypeSystem();
//get types and feature interessted in
HashMap types = processTofs(aCAS, this.tofs);
try
{
//iterate and print annotations
FSIterator typeIterator = aCAS.getAnnotationIndex().iterator();
for (typeIterator.moveToFirst(); typeIterator.isValid(); typeIterator.moveToNext())
{
Iterator it = types.keySet().iterator();
while (it.hasNext())
{
//get current type and features
Type currentType = (Type) it.next();
boolean isFeatureOnly = false;
ArrayList featureList = (ArrayList) types.get(currentType);
if(featureList.size() >0 && featureList.get(0).equals(featureOnlyKey)){
featureList.remove(0);
isFeatureOnly = true;
}
Feature[] features = (Feature[]) featureList.toArray(new Feature[] {
});
AnnotationFS annot = (AnnotationFS) typeIterator.get();
if (annot.getType().getName() == currentType.getName())
{
//only for formatting necessary
boolean firstFeature = true;
String span = annot.getCoveredText();
if(!isFeatureOnly){
this.fileWriter.write(
annot.getType().getShortName()
+ "(" + annot.getBegin() + "," + annot.getEnd() + "): " + span);
}else{
this.fileWriter.write(
annot.getType().getShortName()
+ ": ");
}
for (int f = 0; f < features.length; f++)
{
if (firstFeature)
{
this.fileWriter.write(" { ");
firstFeature = false;
}
else
{
this.fileWriter.write(", ");
}
Feature fs = features[f];
int typeClass = ll_cas.ll_getTypeClass(ll_typeSystem.ll_getCodeForType(fs.getRange()));
this.fileWriter.write(fs.getShortName() + "=");
switch (typeClass)
{
case LowLevelCAS.TYPE_CLASS_FLOAT :