private void addResultTof(TypeOrFeature tof, String[] langs, boolean replace) { String name = tof.getName(); String typeName = null; String shortFeatName = null; int i = name.indexOf(TypeSystem.FEATURE_SEPARATOR); if (i < 0) { typeName = name; rsTypesMap.add(typeName, tof.isAllAnnotatorFeatures(), langs, replace); } else { typeName = name.substring(0, i); shortFeatName = name.substring(i+1); rsTypesMap.add(typeName, shortFeatName, langs, replace); } setCompileNeeded(); }
if (!prevTof.isAllAnnotatorFeatures() && nextTof.isAllAnnotatorFeatures()) mergedInputs.put(name, nextTof); if (!prevTof.isAllAnnotatorFeatures() && nextTof.isAllAnnotatorFeatures()) mergedOutputs.put(name, nextTof); TypeOrFeature tof = (TypeOrFeature) mergedInputs.get(name); if (tof.isType()) mergedCapability.addInputType(name, tof.isAllAnnotatorFeatures()); else mergedCapability.addInputFeature(name); TypeOrFeature tof = (TypeOrFeature) mergedOutputs.get(name); if (tof.isType()) mergedCapability.addOutputType(name, tof.isAllAnnotatorFeatures()); else mergedCapability.addOutputFeature(name);
/** * @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(); }
tc = getTypeCapability(name); tc.isInputType = true; if (inputs[i].isAllAnnotatorFeatures()) { fc = getFeatureCapability(tc, ALL_FEATURES); fc.isInputFeature = true; tc = getTypeCapability(name); tc.isOutputType = true; if (outputs[i].isAllAnnotatorFeatures()) { fc = getFeatureCapability(tc, ALL_FEATURES); fc.isOutputType = true;
@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; }