String value = each.getKey().getStringValue(parent, matchedAnnotation, stream);
map.put(value, each.getValue());
}
TypeSystem typeSystem = stream.getCas().getTypeSystem();
JCas jcas = stream.getJCas();
List<?> featuresList = structure.getType().getFeatures();
for (int i = 0; i < featuresList.size(); i++) {
Feature targetFeature = (Feature) featuresList.get(i);
String name = targetFeature.getName();
String shortFName = name.substring(name.indexOf(":") + 1, name.length());
Object valueObject = map.get(shortFName);
Type range = targetFeature.getRange();
if (valueObject != null) {
if (valueObject instanceof TypeExpression
&& range.getName().equals(UIMAConstants.TYPE_STRING)) {
TypeExpression type = (TypeExpression) valueObject;
List<AnnotationFS> annotationsInWindow = stream.getAnnotationsInWindow(matchedAnnotation,
type.getType(parent));
if (annotationsInWindow != null && !annotationsInWindow.isEmpty()) {
AnnotationFS annotation = annotationsInWindow.get(0);
structure.setStringValue(targetFeature, annotation.getCoveredText());
}
} else if (valueObject instanceof IStringExpression
&& range.getName().equals(UIMAConstants.TYPE_STRING)) {
structure.setStringValue(targetFeature, ((IStringExpression) valueObject).getStringValue(
parent, matchedAnnotation, stream));
} else if (valueObject instanceof INumberExpression) {
if (range.getName().equals(UIMAConstants.TYPE_INTEGER)) {
structure.setIntValue(targetFeature, ((INumberExpression) valueObject).getIntegerValue(
parent, matchedAnnotation, stream));
} else if (range.getName().equals(UIMAConstants.TYPE_DOUBLE)) {
structure.setDoubleValue(targetFeature, ((INumberExpression) valueObject)
.getDoubleValue(parent, matchedAnnotation, stream));
} else if (range.getName().equals(UIMAConstants.TYPE_FLOAT)) {
structure.setFloatValue(targetFeature, ((INumberExpression) valueObject).getFloatValue(
parent, matchedAnnotation, stream));
} else if (range.getName().equals(UIMAConstants.TYPE_BYTE)) {
structure.setByteValue(targetFeature, (byte) ((INumberExpression) valueObject)
.getIntegerValue(parent, matchedAnnotation, stream));
} else if (range.getName().equals(UIMAConstants.TYPE_SHORT)) {
structure.setShortValue(targetFeature, (short) ((INumberExpression) valueObject)
.getIntegerValue(parent, matchedAnnotation, stream));
} else if (range.getName().equals(UIMAConstants.TYPE_LONG)) {
structure.setLongValue(targetFeature, (long) ((INumberExpression) valueObject)
.getIntegerValue(parent, matchedAnnotation, stream));
}
} else if (valueObject instanceof IBooleanExpression
&& range.getName().equals(UIMAConstants.TYPE_BOOLEAN)) {
structure.setBooleanValue(targetFeature, ((IBooleanExpression) valueObject)
.getBooleanValue(parent, matchedAnnotation, stream));
} else if (valueObject instanceof TypeExpression) {
TypeExpression type = (TypeExpression) valueObject;
List<AnnotationFS> annotationsInWindow = stream.getAnnotationsInWindow(matchedAnnotation,
type.getType(parent));
if (typeSystem.subsumes(jcas.getCasType(FSArray.type), range)) {
structure
.setFeatureValue(targetFeature, UIMAUtils.toFSArray(jcas, annotationsInWindow));
} else if (typeSystem.subsumes(range, type.getType(parent))
&& !annotationsInWindow.isEmpty()) {
AnnotationFS annotation = annotationsInWindow.get(0);