@Override boolean visit(TypeOrFeature i_o) { if (!i_o.isType() && i_o.getName().equals(oldFullFeatureName)) { somethingChanged[0] = true; i_o.setName(newFullFeatureName); } return false; } };
@Override boolean visit(TypeOrFeature i_o) { if (i_o.isType() && i_o.getName().equals(sOldTypeName)) { capabilityChanged[0] = true; i_o.setName(sNewTypeName); } else if (!i_o.isType() && i_o.getName().startsWith(oldTypeName_colon)) { capabilityChanged[0] = true; i_o.setName(sNewTypeName + ':' + i_o.getName().substring(oldTypeName_colon.length())); } return false; } };
/** * New feature. * * @param name the name * @return the type or feature */ private TypeOrFeature newFeature(String name) { TypeOrFeature result = new TypeOrFeature_impl(); result.setType(false); result.setName(name); return result; }
private static TypeOrFeature[] createTypesOrFeatures(String[] typesOrFeatureNames) { if (typesOrFeatureNames.length == 1 && typesOrFeatureNames[0].equals(TypeCapability.NO_DEFAULT_VALUE)) { return new TypeOrFeature[0]; } else { List<TypeOrFeature> typesOrFeatures = new ArrayList<TypeOrFeature>(); for (String name : typesOrFeatureNames) { TypeOrFeature tof = new TypeOrFeature_impl(); tof.setName(name); if (name.indexOf(":") == -1) { tof.setType(true); } else { tof.setType(false); } typesOrFeatures.add(tof); } return typesOrFeatures.toArray(new TypeOrFeature[typesOrFeatures.size()]); } } }
private TypeOrFeature createTypeOrFeature(String name, boolean isType, boolean aAllAnnotatorFeatures) { TypeOrFeature r = new TypeOrFeature_impl(); r.setType(isType); r.setName(name); if (isType) { r.setAllAnnotatorFeatures(aAllAnnotatorFeatures); } return r; }
/** * @see org.apache.uima.resource.metadata.Capability#addInputFeature(java.lang.String) */ public void addInputFeature(String aFeatureName) { TypeOrFeature feat = UIMAFramework.getResourceSpecifierFactory().createTypeOrFeature(); feat.setType(false); feat.setName(aFeatureName); TypeOrFeature[] oldArr = getInputs(); TypeOrFeature[] newArr = new TypeOrFeature[oldArr.length + 1]; System.arraycopy(oldArr, 0, newArr, 0, oldArr.length); newArr[newArr.length - 1] = feat; setInputs(newArr); }
/** * @see org.apache.uima.resource.metadata.Capability#addOutputFeature(java.lang.String) */ public void addOutputFeature(String aFeatureName) { TypeOrFeature feat = UIMAFramework.getResourceSpecifierFactory().createTypeOrFeature(); feat.setType(false); feat.setName(aFeatureName); TypeOrFeature[] oldArr = getOutputs(); TypeOrFeature[] newArr = new TypeOrFeature[oldArr.length + 1]; System.arraycopy(oldArr, 0, newArr, 0, oldArr.length); newArr[newArr.length - 1] = feat; setOutputs(newArr); }
/** * @see org.apache.uima.resource.metadata.Capability#addInputType(java.lang.String, * boolean) */ public void addInputType(String aTypeName, boolean aAllAnnotatorFeatures) { TypeOrFeature type = UIMAFramework.getResourceSpecifierFactory().createTypeOrFeature(); type.setType(true); type.setName(aTypeName); type.setAllAnnotatorFeatures(aAllAnnotatorFeatures); TypeOrFeature[] oldArr = getInputs(); TypeOrFeature[] newArr = new TypeOrFeature[oldArr.length + 1]; System.arraycopy(oldArr, 0, newArr, 0, oldArr.length); newArr[newArr.length - 1] = type; setInputs(newArr); }
/** * @see org.apache.uima.resource.metadata.Capability#addOutputType(java.lang.String, * boolean) */ public void addOutputType(String aTypeName, boolean aAllAnnotatorFeatures) { TypeOrFeature type = UIMAFramework.getResourceSpecifierFactory().createTypeOrFeature(); type.setType(true); type.setName(aTypeName); type.setAllAnnotatorFeatures(aAllAnnotatorFeatures); TypeOrFeature[] oldArr = getOutputs(); TypeOrFeature[] newArr = new TypeOrFeature[oldArr.length + 1]; System.arraycopy(oldArr, 0, newArr, 0, oldArr.length); newArr[newArr.length - 1] = type; setOutputs(newArr); }
tORf[i].setName(newKey); modified = false;