FeatureStructure featureStructure;
if (parentElement instanceof ModelFeatureStructure) {
featureStructure = ((ModelFeatureStructure) parentElement).getStructre();
} else if (parentElement instanceof FeatureValue) {
FeatureValue value = (FeatureValue) parentElement;
if (parentElement instanceof StringArray) {
StringArray array = (StringArray) parentElement;
return array.toArray();
}
featureStructure = (FeatureStructure) value.getValue();
} else {
assert false : "Unexpected element!";
return new Object[] {};
}
Type type = featureStructure.getType();
Vector featureTypes = type.getAppropriateFeatures();
Iterator featuresItertor = featureTypes.iterator();
while (featuresItertor.hasNext()) {
Feature feature = (Feature) featuresItertor.next();
if (Primitives.isPrimitive(feature)) {
// create a new pair
// feature and value
// add string
childs.add(new FeatureValue(mDocument, featureStructure, feature));
} else {
childs.add(new FeatureValue(mDocument, featureStructure, feature));
}
}
assert childs.size() > 0;