net.sf.taverna.t2.workflowmodel.processor.activity.Activity类的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(10.7k)|赞(0)|评价(0)|浏览(162)

本文整理了Java中net.sf.taverna.t2.workflowmodel.processor.activity.Activity类的一些代码示例,展示了Activity类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Activity类的具体详情如下:
包路径:net.sf.taverna.t2.workflowmodel.processor.activity.Activity
类名称:Activity

Activity介绍

[英]Defines a single abstract or concrete invokable activity. Each Processor contains at least one of these and may contain many, similarly the dispatch stack may create new Activity instances from e.g. dynamic lookup or resolution of an abstract activity to a concrete activity or set of activities.
[中]定义单个抽象或具体的可调用活动。每个处理器至少包含其中一个,并且可能包含多个,类似地,调度堆栈可以创建新的活动实例,例如,从抽象活动的动态查找或解析到具体活动或活动集。

代码示例

代码示例来源:origin: net.sf.taverna.t2.ui-exts/loop-ui

private HashSet<String> findFeedbackPorts() {
    HashSet<String> incoming = new HashSet<String>();
    for (InputPort inputPort : activityToCompare.getInputPorts()) {
      String activityPortName = inputPort.getName();
      String processorPortName = activityToCompare.getInputPortMapping()
          .get(activityPortName);
      if (processorPortName == null) {
        // We'll need to map it later
        processorPortName = activityPortName;
      }
      incoming.add(processorPortName);
    }

    HashSet<String> outgoing = new HashSet<String>();
    for (OutputPort outputPort : activityToCompare.getOutputPorts()) {
      String activityPortName = outputPort.getName();
      String processorPortName = activityToCompare.getOutputPortMapping()
          .get(activityPortName);
      if (processorPortName == null) {
        // We'll need to map it later
        processorPortName = activityPortName;
      }
      outgoing.add(processorPortName);
    }

    // Return the port names that are common
    incoming.retainAll(outgoing);
    return incoming;
  }
}

代码示例来源:origin: net.sf.taverna.t2/workflowmodel-impl

for (String processorInputName : activity.getInputPortMapping()
    .keySet()) {
  Element mapElement = new Element(MAP, T2_WORKFLOW_NAMESPACE);
  mapElement.setAttribute(FROM, processorInputName);
  mapElement.setAttribute(TO, activity.getInputPortMapping().get(
      processorInputName));
  ipElement.addContent(mapElement);
for (String activityOutputName : activity.getOutputPortMapping()
    .keySet()) {
  Element mapElement = new Element(MAP, T2_WORKFLOW_NAMESPACE);
  mapElement.setAttribute(FROM, activityOutputName);
  mapElement.setAttribute(TO, activity.getOutputPortMapping().get(
      activityOutputName));
  opElement.addContent(mapElement);
Object o = activity.getConfiguration();
Element configElement = beanAsElement(o);
activityElem.addContent(configElement);

代码示例来源:origin: net.sf.taverna.t2.core/workflowmodel-impl

String processorInputName = mapElement.getAttributeValue(FROM);
  String activityInputName = mapElement.getAttributeValue(TO);
  activity.getInputPortMapping().put(processorInputName,
      activityInputName);
  String activityOutputName = mapElement.getAttributeValue(FROM);
  String processorOutputName = mapElement.getAttributeValue(TO);
  activity.getOutputPortMapping().put(activityOutputName,
      processorOutputName);
activity.configure(configObject);
return activity;

代码示例来源:origin: net.sf.taverna.t2.activities/external-tool-activity

private static ActivityOutputPort getActivityOutputPort(
    Activity<?> activity, ProcessorPort processorOutputPort) {
  ProcessorInputPort result = null;
  for (Entry<String, String> mapEntry : activity.getOutputPortMapping()
      .entrySet()) {
    if (mapEntry.getKey().equals(processorOutputPort.getName())) {
      for (OutputPort activityOutputPort : activity
          .getOutputPorts()) {
        if (activityOutputPort.getName().equals(mapEntry.getValue())) {
          return (ActivityOutputPort) activityOutputPort;
        }
      }
      break;
    }
  }
  return null;
}

代码示例来源:origin: net.sf.taverna.t2.ui-components/workflow-explorer

activity.getInputPorts());
Collections.sort(inputPorts, portComparator);
for (ActivityInputPort inputPort : inputPorts) {
    .getOutputPorts());
Collections.sort(outputPorts, portComparator);
for (OutputPort outputPort : outputPorts) {

代码示例来源:origin: net.sf.taverna.t2/compatibility-impl

assertEquals(2, activity.getInputPorts().size());
assertEquals(1, activity.getOutputPorts().size());
for (Port inPort : activity.getInputPorts()) {
  if (inPort.getName().equals("input1"))
    in1 = inPort;
assertNotNull("No input named input2 found", in2);
Port out1 = (Port) activity.getOutputPorts().toArray()[0];
assertEquals(0, out1.getDepth());
assertNotNull(activity.getConfiguration());

代码示例来源:origin: net.sf.taverna.t2.core/workflowmodel-api

public static ActivityInputPort getActivityInputPort(Activity<?> activity,
    String portName) {
  ActivityInputPort activityInputPort = null;
  for (ActivityInputPort inputPort : activity.getInputPorts()) {
    if (inputPort.getName().equals(portName)) {
      activityInputPort = inputPort;
      break;
    }
  }
  return activityInputPort;
}

代码示例来源:origin: net.sf.taverna.t2.core/workflowmodel-api

try {
  Activity aa = (Activity) (conf.getActivity().getClass().newInstance());
  aa.configure(newConfig);
  boolean unknownPort = false;
  Map<String, String> currentInputPortMap = this
  HashSet<String> currentInputNames = new HashSet<String>();
  currentInputNames.addAll(currentInputPortMap.values()) ;
  for (ActivityInputPort aip : ((Activity<?>)aa).getInputPorts()) {
    currentInputNames.remove(aip.getName());
    HashSet<String> currentOutputNames = new HashSet<String>();
    currentOutputNames.addAll(currentOutputPortMap.values()) ;
    for (OutputPort aop : ((Activity<?>)aa).getOutputPorts()) {
      currentOutputNames.remove(aop.getName());

代码示例来源:origin: net.sf.taverna.t2.ui-components/graph-model

private boolean isSingleOutputProcessor(Object dataflowObject) {
  if (!(dataflowObject instanceof Processor)) {
    return false;
  }
  Processor p = (Processor) dataflowObject;
  List<? extends Activity<?>> activities = p.getActivityList();
  if (activities.size() > 0) {
    Set<OutputPort> ports = activities.get(0).getOutputPorts();
    return (ports.size() == 1);
  }
  return false;
}

代码示例来源:origin: net.sf.taverna.t2.ui-impl/contextual-views-impl

@SuppressWarnings("unchecked")
public ConfigBean getConfigBean() {
  return (ConfigBean)activity.getConfiguration();
}

代码示例来源:origin: net.sf.taverna.t2.core/workflowmodel-impl

for (String processorInputName : describingActivity.getInputPortMapping()
    .keySet()) {
  Element mapElement = new Element(MAP, T2_WORKFLOW_NAMESPACE);
  mapElement.setAttribute(FROM, processorInputName);
  mapElement.setAttribute(TO, describingActivity.getInputPortMapping().get(
      processorInputName));
  ipElement.addContent(mapElement);
for (String activityOutputName : describingActivity.getOutputPortMapping()
    .keySet()) {
  Element mapElement = new Element(MAP, T2_WORKFLOW_NAMESPACE);
  mapElement.setAttribute(FROM, activityOutputName);
  mapElement.setAttribute(TO, describingActivity.getOutputPortMapping().get(
      activityOutputName));
  opElement.addContent(mapElement);

代码示例来源:origin: net.sf.taverna.t2/cyclone-impl

ActivityTranslatorNotFoundException, ActivityTranslationException,
  ActivityConfigurationException, WorkflowTranslationException {
Set<ActivityInputPort> inputPorts = activity.getInputPorts();
Map<String, org.embl.ebi.escience.scufl.InputPort> t1InputPorts = getInputPortMap(t1Processor);
for (InputPort inputPort : inputPorts) {
            .getName(), inputPort.getDepth());
    addInputPortEdit.doEdit();
    activity.getInputPortMapping().put(inputPort.getName(),
        inputPort.getName());

代码示例来源:origin: net.sf.taverna.t2.core/workflowmodel-api

public static ProcessorOutputPort getProcessorOutputPort(
    Processor processor, Activity<?> activity,
    OutputPort activityOutputPort) {
  ProcessorOutputPort result = null;
  for (Entry<String, String> mapEntry : activity.getOutputPortMapping()
      .entrySet()) {
    if (mapEntry.getValue().equals(activityOutputPort.getName())) {
      for (ProcessorOutputPort processorOutputPort : processor
          .getOutputPorts()) {
        if (processorOutputPort.getName().equals(mapEntry.getKey())) {
          result = processorOutputPort;
          break;
        }
      }
      break;
    }
  }
  return result;
}

代码示例来源:origin: net.sf.taverna.t2.core/workflowmodel-api

public static ProcessorInputPort getProcessorInputPort(Processor processor,
    Activity<?> activity, InputPort activityInputPort) {
  ProcessorInputPort result = null;
  for (Entry<String, String> mapEntry : activity.getInputPortMapping()
      .entrySet()) {
    if (mapEntry.getValue().equals(activityInputPort.getName())) {
      for (ProcessorInputPort processorInputPort : processor
          .getInputPorts()) {
        if (processorInputPort.getName().equals(mapEntry.getKey())) {
          result = processorInputPort;
          break;
        }
      }
      break;
    }
  }
  return result;
}

代码示例来源:origin: net.sf.taverna.t2/cyclone-api

/**
 * <p>
 * The entry point for carrying out a translation from a Taverna 1 Processor to a Taverna 2 Activity.<br>
 * </p>
 * 
 * @param processor
 * @return a translated Activity
 * @throws ActivityTranslationException
 * @throws ActivityConfigurationException
 */
public Activity<ConfigurationType> doTranslation(Processor processor)
    throws ActivityTranslationException,ActivityConfigurationException {
  Activity<ConfigurationType> activity = createUnconfiguredActivity();
  ConfigurationType configType = createConfigType(processor);
  activity.configure(configType);
  return activity;
}

代码示例来源:origin: net.sf.taverna.t2.ui-activities/disabled-activity-ui

html = html + "<tr><th>Input Port Name</th><th>Port depth</th>"
    + "</tr>";
for (ActivityInputPort aip : getActivity().getInputPorts()) {
  html = html + "<tr><td>" + aip.getName() + "</td><td>"
      + aip.getDepth() + "</td></tr>";
for (OutputPort aop : getActivity().getOutputPorts()) {
  html = html + "<tr><td>" + aop.getName() + "</td><td>"
      + aop.getDepth() + "</td></tr>";

代码示例来源:origin: net.sf.taverna.t2/cyclone-impl

assertEquals(2, activity.getInputPorts().size());
assertEquals(1, activity.getOutputPorts().size());
for (Port inPort : activity.getInputPorts()) {
  if (inPort.getName().equals("input1"))
    in1 = inPort;
assertNotNull("No input named input2 found", in2);
Port out1 = (Port) activity.getOutputPorts().toArray()[0];
assertEquals(0, out1.getDepth());
assertNotNull(activity.getConfiguration());

代码示例来源:origin: net.sf.taverna.t2/workflowmodel-impl

public static ActivityInputPort getActivityInputPort(Activity<?> activity,
    String portName) {
  ActivityInputPort activityInputPort = null;
  for (ActivityInputPort inputPort : activity.getInputPorts()) {
    if (inputPort.getName().equals(portName)) {
      activityInputPort = inputPort;
      break;
    }
  }
  return activityInputPort;
}

代码示例来源:origin: net.sf.taverna.t2/cyclone-impl

/**
 * @param activity
 * @param t2Processor
 * @throws EditException
 */
private void addOutputPorts(Activity<?> activity, Processor t2Processor)
    throws EditException {
  Set<OutputPort> outputPorts = activity.getOutputPorts();
  for (OutputPort outputPort : outputPorts) {
    Edit<Processor> addOutputPortEdit = edits
        .getCreateProcessorOutputPortEdit(t2Processor, outputPort
            .getName(), outputPort.getDepth(), outputPort
            .getGranularDepth());
    addOutputPortEdit.doEdit();
    activity.getOutputPortMapping().put(outputPort.getName(),
        outputPort.getName());
  }
}

代码示例来源:origin: net.sf.taverna.t2/workflowmodel-impl

public static OutputPort getActivityOutputPort(Activity<?> activity,
    String portName) {
  OutputPort activityOutputPort = null;
  for (OutputPort outputPort : activity.getOutputPorts()) {
    if (outputPort.getName().equals(portName)) {
      activityOutputPort = outputPort;
      break;
    }
  }
  return activityOutputPort;
}

相关文章