org.apache.taverna.scufl2.api.core.Workflow.getControlLinks()方法的使用及代码示例

x33g5p2x  于2022-02-03 转载在 其他  
字(7.7k)|赞(0)|评价(0)|浏览(131)

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

Workflow.getControlLinks介绍

[英]Returns the ControlLinks. If there are no ControlLinks an empty set is returned.
[中]返回ControlLinks。如果没有ControlLinks,则返回一个空集。

代码示例

代码示例来源:origin: org.apache.taverna.language/taverna-scufl2-api

@Override
public void setParent(Workflow parent) {
  if (this.parent != null && this.parent != parent)
    this.parent.getControlLinks().remove(this);
  this.parent = parent;
  if (parent != null)
    parent.getControlLinks().add(this);
}

代码示例来源:origin: org.apache.taverna.language/taverna-scufl2-api

@SuppressWarnings("unchecked")
public List<BlockingControlLink> controlLinksBlocking(Processor blocked) {
  List<BlockingControlLink> controlLinks = new ArrayList<>();
  for (ControlLink link : blocked.getParent().getControlLinks()) {
    if (!(link instanceof BlockingControlLink))
      continue;
    BlockingControlLink blockingControlLink = (BlockingControlLink) link;
    if (blockingControlLink.getBlock().equals(blocked))
      controlLinks.add(blockingControlLink);
  }
  Collections.sort(controlLinks);
  return controlLinks;
}

代码示例来源:origin: org.apache.taverna.language/taverna-scufl2-api

@SuppressWarnings("unchecked")
public List<BlockingControlLink> controlLinksWaitingFor(
    Processor untilFinished) {
  List<BlockingControlLink> controlLinks = new ArrayList<>();
  for (ControlLink link : untilFinished.getParent().getControlLinks()) {
    if (!(link instanceof BlockingControlLink))
      continue;
    BlockingControlLink blockingControlLink = (BlockingControlLink) link;
    if (blockingControlLink.getUntilFinished().equals(untilFinished))
      controlLinks.add(blockingControlLink);
  }
  Collections.sort(controlLinks);
  return controlLinks;
}

代码示例来源:origin: org.apache.taverna.language/taverna-scufl2-api

@Override
public boolean accept(Visitor visitor) {
  if (visitor.visitEnter(this)) {
    List<WorkflowBean> children = new ArrayList<>();
    children.addAll(getInputPorts());
    children.addAll(getOutputPorts());
    children.addAll(getProcessors());
    children.addAll(getDataLinks());
    children.addAll(getControlLinks());
    children.add(getCurrentRevision());
    for (WorkflowBean bean : children)
      if (!bean.accept(visitor))
        break;
  }
  return visitor.visitLeave(this);
}

代码示例来源:origin: org.apache.taverna.language/taverna-scufl2-api

@Override
public void visitWorkflow(Workflow bean) {
  Set<DataLink> dataLinks = bean.getDataLinks();
  Set<ControlLink> controlLinks = bean.getControlLinks();
  
  // ports are done in Ported
  
  NamedSet<Processor> processors = bean.getProcessors();
  URI workflowIdentifier = bean.getIdentifier();
  
  if (workflowIdentifier != null) {
    if (!workflowIdentifier.isAbsolute())
      listener.nonAbsoluteURI(bean, "workflowIdentifier", workflowIdentifier);
    else if (workflowIdentifier.getScheme().equals("file"))
      listener.nonAbsoluteURI(bean, "workflowIdentifier", workflowIdentifier);
  }
  
  if (checkComplete) {
    if (dataLinks == null)
      listener.nullField(bean, "dataLinks");
    if (controlLinks == null)
      listener.nullField(bean, "controlLinks");
    if (processors == null)
      listener.nullField(bean, "processors");
    if (workflowIdentifier == null)
      listener.nullField(bean, "workflowIdentifier");
  }
}

代码示例来源:origin: org.apache.taverna.language/taverna-scufl2-api

@Test
public void uriForControlLink() throws Exception {
  Processor hello = wfBundle.getMainWorkflow().getProcessors()
      .getByName("Hello");
  assertNotNull(hello);
  ControlLink condition = wfBundle.getMainWorkflow().getControlLinks()
      .iterator().next();
  assertTrue(condition instanceof BlockingControlLink);
  URI uri = uriTools.uriForBean(condition);
  assertEquals(
      HELLOWORLD_URI
          + "control?block=processor/Hello/&untilFinished=processor/wait4me/",
      uri.toASCIIString());
}

代码示例来源:origin: org.apache.taverna.language/taverna-scufl2-api

@Test
public void controlLinksBlocking() {
  Processor hello = workflowBundle.getMainWorkflow().getProcessors()
      .getByName("Hello");
  Processor wait4me = workflowBundle.getMainWorkflow().getProcessors()
      .getByName("wait4me");
  ControlLink controlLink = workflowBundle.getMainWorkflow().getControlLinks()
      .iterator().next();
  assertEquals(Collections.singletonList(controlLink),
      scufl2Tools.controlLinksBlocking(hello));
  assertTrue(scufl2Tools.controlLinksBlocking(wait4me).isEmpty());
}

代码示例来源:origin: org.apache.taverna.language/taverna-scufl2-api

@Test
public void controlLinksWaitingFor() {
  Processor hello = workflowBundle.getMainWorkflow().getProcessors()
      .getByName("Hello");
  Processor wait4me = workflowBundle.getMainWorkflow().getProcessors()
      .getByName("wait4me");
  ControlLink controlLink = workflowBundle.getMainWorkflow().getControlLinks()
      .iterator().next();
  assertEquals(Collections.singletonList(controlLink),
      scufl2Tools.controlLinksWaitingFor(wait4me));
  assertTrue(scufl2Tools.controlLinksWaitingFor(hello).isEmpty());
}

代码示例来源:origin: org.apache.taverna.language/taverna-scufl2-api

@SuppressWarnings("unchecked")
@Test
public void expectedOrder() throws Exception {
  Workflow wf = new Workflow();		
  wf.setName("wf");
  
  Processor a = new Processor(wf, "a");
  Processor b = new Processor(wf, "b");
  Processor c = new Processor(wf, "c");
  Processor d = new Processor(wf, "d");
  BlockingControlLink b_blocks_c = new BlockingControlLink(c, b);
  BlockingControlLink a_blocks_c = new BlockingControlLink(c, a);
  BlockingControlLink a_blocks_b = new BlockingControlLink(b, a);
  BlockingControlLink b_blocks_d = new BlockingControlLink(d, b);
  BlockingControlLink a_blocks_d = new BlockingControlLink(d, a);
  
  ArrayList<ControlLink> links = new ArrayList<ControlLink>(wf.getControlLinks());
  assertEquals(Arrays.asList(a_blocks_b, a_blocks_c, a_blocks_d, b_blocks_c, b_blocks_d), links);
  Collections.shuffle(links);
  Collections.sort(links);
  assertEquals(Arrays.asList(a_blocks_b, a_blocks_c, a_blocks_d, b_blocks_c, b_blocks_d), links);
}

代码示例来源:origin: org.apache.taverna.language/taverna-scufl2-t2flow

@Test
public void readControlLinks() throws Exception {
  URL wfResource = getClass().getResource(SLEEPERS_T2FLOW);
  assertNotNull("Could not find workflow " + SLEEPERS_T2FLOW, wfResource);
  T2FlowParser parser = new T2FlowParser();
  parser.setStrict(true);
  WorkflowBundle bundle = parser.parseT2Flow(wfResource.openStream());
  Workflow mainWorkflow = bundle.getMainWorkflow();
  NamedSet<Processor> processors = mainWorkflow.getProcessors();
  assertEquals(4, mainWorkflow.getControlLinks().size());
  
  List<BlockingControlLink> blocking2 = scufl2Tools.controlLinksBlocking(processors.getByName("second_sleeper"));
  assertEquals(1, blocking2.size());
  assertEquals("first_sleeper", blocking2.get(0).getUntilFinished().getName());
  
  List<BlockingControlLink> waiting2 = scufl2Tools.controlLinksWaitingFor(processors.getByName("second_sleeper"));
  assertEquals(1, waiting2.size());
  assertEquals("third_sleeper", waiting2.get(0).getBlock().getName());
  
  
  List<BlockingControlLink> blocking3 = scufl2Tools.controlLinksBlocking(processors.getByName("third_sleeper"));
  assertEquals(2, blocking3.size());
  assertEquals("second_sleeper", blocking3.get(0).getUntilFinished().getName());
  assertEquals("second_sleeper_2", blocking3.get(1).getUntilFinished().getName());
  
  
  
}

代码示例来源:origin: org.apache.taverna.language/taverna-scufl2-api

ArrayList<ControlLink> links = new ArrayList<ControlLink>(wf.getControlLinks());
assertEquals(Arrays.asList(null_blocks_null, null_blocks_c, a_blocks_b, b_blocks_null, b_blocks_c), links);

代码示例来源:origin: org.apache.taverna.language/taverna-scufl2-api

if (!wf.getControlLinks().isEmpty()) {
  newLine(2);
  append("Controls");
  List<ControlLink> controlLinks = new ArrayList<>(wf.getControlLinks());
  Collections.sort(controlLinks);
  for (ControlLink controlLink : controlLinks) {

相关文章