throw new IllegalArgumentException("Cannot create FS for primitive type!");
}
FeatureStructure fs;
TypeSystem ts = document.getCAS().getTypeSystem();
if (type.isArray()) {
if (type.getName().equals(CAS.TYPE_NAME_BOOLEAN_ARRAY)) {
fs = document.getCAS().createBooleanArrayFS(arraySize);
} else if (type.getName().equals(CAS.TYPE_NAME_BYTE_ARRAY)) {
fs = document.getCAS().createByteArrayFS(arraySize);
} else if (type.getName().equals(CAS.TYPE_NAME_SHORT_ARRAY)) {
fs = document.getCAS().createShortArrayFS(arraySize);
} else if (type.getName().equals(CAS.TYPE_NAME_INTEGER_ARRAY)) {
fs = document.getCAS().createIntArrayFS(arraySize);
} else if (type.getName().equals(CAS.TYPE_NAME_LONG_ARRAY)) {
fs = document.getCAS().createLongArrayFS(arraySize);
} else if (type.getName().equals(CAS.TYPE_NAME_FLOAT_ARRAY)) {
fs = document.getCAS().createFloatArrayFS(arraySize);
} else if (type.getName().equals(CAS.TYPE_NAME_DOUBLE_ARRAY)) {
fs = document.getCAS().createDoubleArrayFS(arraySize);
} else if (type.getName().equals(CAS.TYPE_NAME_STRING_ARRAY)) {
fs = document.getCAS().createStringArrayFS(arraySize);
} else if (type.getName().equals(CAS.TYPE_NAME_FS_ARRAY)) {
fs = document.getCAS().createArrayFS(arraySize);
} else {
throw new CasEditorError("Unkown array type: " + type.getName() + "!");
}
}
else if (ts.subsumes(ts.getType(CAS.TYPE_NAME_ANNOTATION), type)) {
// get begin of selection from editor, if any
// TODO: Add an interface to retrieve the span from the editor
int begin = 0;