/** * Checks if is output. * * @param fullFeatureName the full feature name * @param c the c * @return true, if is output */ public static boolean isOutput(String fullFeatureName, Capability c) { return null != getTypeOrFeature(c.getOutputs(), fullFeatureName); }
/** Add this crd's capabilities for other downstream aeds. */ private void addCapabilities(CollectionReaderDescription crd) { for (Capability capability : crd.getCollectionReaderMetaData() .getCapabilities()) { for (TypeOrFeature output : capability.getOutputs()) { // LOG.info("add @TypeCapability: " + output.getName()); outputTypes.add(output.getName()); } } }
/** * Match capabilities to. * * @param capabilities the capabilities * @param search the search * @param isInput the is input * @return true, if successful */ private boolean matchCapabilitiesTo(Capability[] capabilities, Pattern search, boolean isInput) { if (null == search) return true; for (int i = 0; i < capabilities.length; i++) { TypeOrFeature[] typeOrFeatures = isInput ? capabilities[i].getInputs() : capabilities[i] .getOutputs(); if (null != typeOrFeatures) { for (int j = 0; j < typeOrFeatures.length; j++) { if (search.matcher(typeOrFeatures[j].getName()).find()) { return true; } } } } return false; }
Capability[] capabilities = aeMetaData.getCapabilities(); for (int i = 0; i < capabilities.length; i++) { TypeOrFeature[] outputs = capabilities[i].getOutputs();
TypeOrFeature[] outputs = capabilities[i].getOutputs();
/** * return true if the type has a feature (except all-features) marked as INPUT (OUTPUT). * * @param typeName the type name * @param IO the io * @return true if the type has a feature (except all-features) marked as INPUT (OUTPUT) */ private boolean someFeatureOnType(String typeName, int IO) { // special case for all-features TypeOrFeature[] tofs = (IO == INPUT) ? capability.getInputs() : capability.getOutputs(); // you can remove the "INPUT" or "OUTPUT" designation from a type // even if it has the all-features flag on. String typeNamePlusColon = typeName + ':'; for (int i = 0; i < tofs.length; i++) { if (!tofs[i].isType() && tofs[i].getName().startsWith(typeNamePlusColon)) return true; } return false; }
Capability[] capabilities = aeMetaData.getCapabilities(); for (int i = 0; i < capabilities.length; i++) { TypeOrFeature[] outputs = capabilities[i].getOutputs();
.getOutputs(); Vector validIOs = new Vector(); for (int i = 0; i < oldIOs.length; i++) {
TypeOrFeature[] outputs = capabilities[i].getOutputs(); for (int j = 0; j < outputs.length; j++) { if (outputs[j].isType()) {
/** * Capability visit. * * @param v the v * @return true, if successful */ private boolean capabilityVisit(CapabilityVisitor v) { Capability[] c = getCapabilities(); for (int ic = 0; ic < c.length; ic++) { TypeOrFeature[] inputs = c[ic].getInputs(); for (int i = 0; i < inputs.length; i++) { if (v.visit(inputs[i])) return true; } TypeOrFeature[] outputs = c[ic].getOutputs(); for (int i = 0; i < outputs.length; i++) { if (v.visit(outputs[i])) return true; } } return false; }
TypeOrFeature[] entryOuts = entry.getOutputs();
/** * Checks that this @param aed is provided with the right {@link Annotation} * s in the upstream of this pipeline, and prints an error log otherwise. * Add this aed's capabilities for other downstream aeds. */ private void checkAndAddCapabilities(AnalysisEngineDescription aed) { for (Capability capability : aed.getAnalysisEngineMetaData() .getCapabilities()) { for (TypeOrFeature input : capability.getInputs()) if (!outputTypes.contains(input.getName())) LOG.error("AnalysisEngine " + aed.getAnnotatorImplementationName() + " is missing input @TypeCapability: " + input.getName()); } for (Capability capability : aed.getAnalysisEngineMetaData() .getCapabilities()) { for (TypeOrFeature output : capability.getOutputs()) { // LOG.info("add @TypeCapability: " + output.getName()); outputTypes.add(output.getName()); } } }
/** * @see org.apache.uima.analysis_engine.ResultSpecification#addCapabilities(org.apache.uima.resource.metadata.Capability[], * boolean) */ public void addCapabilities(Capability[] capabilities, boolean outputs) { if (null == capabilities) { return; } for (Capability capability : capabilities) { TypeOrFeature[] tofs = outputs ? capability.getOutputs() : capability.getInputs(); for (TypeOrFeature tof : tofs) { String typeName = tof.getName(); if (!tof.isType()) { int i = typeName.indexOf(TypeSystem.FEATURE_SEPARATOR); String shortFeatName = typeName.substring(i+1); typeName = typeName.substring(0, i); rsTypesMap.add(typeName, shortFeatName, capability.getLanguagesSupported(), false); } else { rsTypesMap.add(typeName, tof.isAllAnnotatorFeatures(), capability.getLanguagesSupported(), false); } } } setCompileNeeded(); }
if (dialog.allFeaturesOutput && (null == getTypeOrFeature(c.getOutputs(), typeName))) { Utility .popMessage( dialog.allFeaturesOutput = false; } else c.setOutputs(setAllFeatures(c.getOutputs(), typeName, dialog.allFeaturesOutput)); c.setOutputs(replaceFeaturesKeepingTypes(c.getOutputs(), typeName, outputsL));
/** * Removes the feature. * * @param c the c * @param removeItem the remove item */ private void removeFeature(Capability c, TableTreeItem removeItem) { String shortFeatureName = removeItem.getText(NAME_COL); if (shortFeatureName.equals(ALL_FEATURES)) { if (isInput(removeItem)) { TypeOrFeature tfItem = getTypeOrFeature(c.getInputs(), getFullyQualifiedName(removeItem .getParentItem())); tfItem.setAllAnnotatorFeatures(false); } if (isOutput(removeItem) /* || isUpdate(removeItem) */) { TypeOrFeature tfItem = getTypeOrFeature(c.getOutputs(), getFullyQualifiedName(removeItem .getParentItem())); tfItem.setAllAnnotatorFeatures(false); } } else { String featureNameToRemove = getFullyQualifiedName(removeItem.getParentItem()) + ":" + removeItem.getText(NAME_COL); if (isInput(removeItem)) c.setInputs(typeOrFeatureArrayRemove(c.getInputs(), featureNameToRemove)); if (isOutput(removeItem) /* || isUpdate(removeItem) */) c.setOutputs(typeOrFeatureArrayRemove(c.getOutputs(), featureNameToRemove)); } removeItem.dispose(); }
TypeOrFeature[] outputs = capabilities[0].getOutputs(); if (outputs != null) { for (int i = 0; i < outputs.length; i++) {
&& !hasType(capability.getOutputs(), allTypes[i])) { TableItem item = new TableItem(table, SWT.NONE); setGuiTypeName(item, allTypes[i]); capabilitySection.getFullyQualifiedName(existing)); setChecked(item, 1, null != tof); tof = AbstractSection.getTypeOrFeature(capability.getOutputs(), capabilitySection .getFullyQualifiedName(existing)); setChecked(item, 2, null != tof);
c[ic].setInputs(deleteTypeOrFeatureFromCapability(c[ic].getInputs(), isType, typeOrFeatureName, typeName)); c[ic].setOutputs(deleteTypeOrFeatureFromCapability(c[ic].getOutputs(), isType, typeOrFeatureName, typeName));
@Override protected Control createDialogArea(Composite parent) { Composite composite = (Composite) super.createDialogArea(parent); table = newTable(composite, SWT.MULTI | SWT.BORDER | SWT.V_SCROLL | SWT.FULL_SELECTION); ((GridData) table.getLayoutData()).heightHint = 100; table.setHeaderVisible(true); table.setLinesVisible(true); new TableColumn(table, SWT.NONE).setText("Feature Name"); new TableColumn(table, SWT.NONE).setText("Input"); new TableColumn(table, SWT.NONE).setText("Output"); TableItem item = new TableItem(table, SWT.NONE); item.setText(0, CapabilitySection.ALL_FEATURES); TypeOrFeature tof = AbstractSection.getTypeOrFeature(capability.getInputs(), selectedType .getName()); setChecked(item, 1, null == tof ? false : tof.isAllAnnotatorFeatures()); tof = AbstractSection.getTypeOrFeature(capability.getOutputs(), selectedType.getName()); setChecked(item, 2, null == tof ? false : tof.isAllAnnotatorFeatures()); for (int i = 0; i < allFeatures.length; i++) { item = new TableItem(table, SWT.NONE); item.setText(0, allFeatures[i].getShortName()); setChecked(item, 1, CapabilitySection.isInput(getTypeFeature(allFeatures[i]), capability)); setChecked(item, 2, CapabilitySection.isOutput(getTypeFeature(allFeatures[i]), capability)); } table.removeListener(SWT.Selection, this); table.addListener(SWT.MouseDown, this); // for i / o toggling section.packTable(table); newErrorMessage(composite); return composite; }
c.setInputs(typeOrFeatureArrayRemove(c.getInputs(), typeNameToRemove)); if (isOutput(removeItem) /* || isUpdate(removeItem) */) c.setOutputs(typeOrFeatureArrayRemove(c.getOutputs(), typeNameToRemove));