本文整理了Java中net.sf.taverna.t2.workflowmodel.Processor.getInputPorts()
方法的一些代码示例,展示了Processor.getInputPorts()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Processor.getInputPorts()
方法的具体详情如下:
包路径:net.sf.taverna.t2.workflowmodel.Processor
类名称:Processor
方法名:getInputPorts
[英]Each processor has a list of zero or more input ports. These are uniquely named within the list. Any input port may have a default value associated with it and may be attached to exactly one upstream output port. Where it is necessary to connect a single input port to multiple output ports a Merge object is used. Ordering within the list is not meaningful but we use List rather than Set to preserve the ordering across serialisation operations.
Processor inputs are instances of FilteringInputPort - they must have the filter depth set before any data events arrive at the Processor. In addition they assume that a full collection will be supplied, i.e. that there will be exactly one event at the end of the list of events for a given process ID with an index array of length zero.
[中]每个处理器都有一个包含零个或多个输入端口的列表。这些在列表中是唯一命名的。任何输入端口都可能有一个与之关联的默认值,并且可能恰好连接到一个上游输出端口。如果需要将单个输入端口连接到多个输出端口,则使用合并对象。列表中的排序没有意义,但我们使用列表而不是集合来保存序列化操作中的排序。
处理器输入是FilteringInputPort的实例——在任何数据事件到达处理器之前,必须设置过滤器深度。此外,他们还假设将提供完整的集合,即对于一个索引数组长度为零的给定进程ID,在事件列表的末尾正好有一个事件。
代码示例来源:origin: net.sf.taverna.t2/compatibility-impl
private EventHandlingInputPort findInputPort(Processor processor,
String name) {
for (EventHandlingInputPort inputPort : processor.getInputPorts()) {
if (inputPort.getName().equals(name)) {
return inputPort;
}
}
return null;
}
代码示例来源:origin: net.sf.taverna.t2/cyclone-impl
private EventHandlingInputPort findInputPort(Processor processor,
String name) {
for (EventHandlingInputPort inputPort : processor.getInputPorts()) {
if (inputPort.getName().equals(name)) {
return inputPort;
}
}
return null;
}
代码示例来源:origin: net.sf.taverna.t2/workflowmodel-impl
private EventHandlingInputPort findProcessorInputPort(
Map<String, Processor> createdProcessors, String portName,
String processorName) throws DeserializationException {
EventHandlingInputPort result = null;
Processor p = createdProcessors.get(processorName);
if (p == null)
throw new DeserializationException(
"Unable to find processor named:" + processorName);
for (ProcessorInputPort port : p.getInputPorts()) {
if (port.getName().equals(portName)) {
result = port;
break;
}
}
return result;
}
代码示例来源:origin: net.sf.taverna.t2.core/workflowmodel-impl
private EventHandlingInputPort findProcessorInputPort(
Map<String, Processor> createdProcessors, String portName,
String processorName) throws DeserializationException {
EventHandlingInputPort result = null;
Processor p = createdProcessors.get(processorName);
if (p == null)
throw new DeserializationException(
"Unable to find processor named:" + processorName);
for (ProcessorInputPort port : p.getInputPorts()) {
if (port.getName().equals(portName)) {
result = port;
break;
}
}
return result;
}
代码示例来源:origin: net.sf.taverna.t2/workflowmodel-impl
private Element processorInputPortsToXML(Processor processor) {
Element inputPorts = new Element(PROCESSOR_INPUT_PORTS,
T2_WORKFLOW_NAMESPACE);
for (ProcessorInputPort port : processor.getInputPorts()) {
Element portElement = new Element(PROCESSOR_PORT,
T2_WORKFLOW_NAMESPACE);
Element name = new Element(NAME, T2_WORKFLOW_NAMESPACE);
Element depth = new Element(DEPTH, T2_WORKFLOW_NAMESPACE);
name.setText(port.getName());
depth.setText(String.valueOf(port.getDepth()));
portElement.addContent(name);
portElement.addContent(depth);
inputPorts.addContent(portElement);
}
return inputPorts;
}
}
代码示例来源: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.core/workflowmodel-impl
private Element processorInputPortsToXML(Processor processor) {
Element inputPorts = new Element(PROCESSOR_INPUT_PORTS,
T2_WORKFLOW_NAMESPACE);
for (ProcessorInputPort port : processor.getInputPorts()) {
Element portElement = new Element(PROCESSOR_PORT,
T2_WORKFLOW_NAMESPACE);
Element name = new Element(NAME, T2_WORKFLOW_NAMESPACE);
Element depth = new Element(DEPTH, T2_WORKFLOW_NAMESPACE);
name.setText(port.getName());
depth.setText(String.valueOf(port.getDepth()));
portElement.addContent(name);
portElement.addContent(depth);
inputPorts.addContent(portElement);
}
return inputPorts;
}
}
代码示例来源:origin: net.sf.taverna.t2/workflowmodel-impl
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.ui-activities/component-activity-ui
private void transferProcessor(List<Edit<?>> editList,
Map<Object, Object> oldNewMapping, Dataflow nestedDataflow,
Processor p) throws Exception {
editList.add(edits.getRemoveProcessorEdit(currentDataflow, p));
Processor newProcessor = pasteProcessor(copyProcessor(p),
nestedDataflow);
oldNewMapping.put(p, newProcessor);
for (ProcessorInputPort pip : p.getInputPorts())
for (ProcessorInputPort newPip : newProcessor.getInputPorts())
if (pip.getName().equals(newPip.getName())) {
oldNewMapping.put(pip, newPip);
break;
}
for (ProcessorOutputPort pop : p.getOutputPorts())
for (ProcessorOutputPort newPop : newProcessor.getOutputPorts())
if (pop.getName().equals(newPop.getName())) {
oldNewMapping.put(pop, newPop);
break;
}
}
代码示例来源:origin: net.sf.taverna.t2.core/workflowmodel-impl
private List<ProcessorInputPort> determineInputPortsForRemoval(Processor p,Activity<?>a) {
List<ProcessorInputPort> result = new ArrayList<ProcessorInputPort>();
for (ProcessorInputPort pPort : p.getInputPorts()) {
boolean found=false;
for (ActivityInputPort aPort : a.getInputPorts()) {
if (aPort.getName().equals(pPort.getName())) {
if (pPort.getDepth() == aPort.getDepth()) {
found=true;
}
break;
}
}
if (!found) {
result.add(pPort);
}
}
return result;
}
代码示例来源:origin: net.sf.taverna.t2/workflowmodel-impl
private List<ProcessorInputPort> determineInputPortsForRemoval(Processor p,Activity<?>a) {
List<ProcessorInputPort> result = new ArrayList<ProcessorInputPort>();
for (ProcessorInputPort pPort : p.getInputPorts()) {
boolean found=false;
for (ActivityInputPort aPort : a.getInputPorts()) {
if (aPort.getName().equals(pPort.getName())) {
if (pPort.getDepth() == aPort.getDepth()) {
found=true;
}
break;
}
}
if (!found) {
result.add(pPort);
}
}
return result;
}
代码示例来源:origin: net.sf.taverna.t2/maelstrom-impl
public void fire(String owningProcess, InvocationContext context) {
String newOwningProcess = owningProcess + ":" + getLocalName();
for (Processor p : processors) {
if (p.getInputPorts().isEmpty()) {
p.fire(newOwningProcess, context);
}
}
}
代码示例来源:origin: net.sf.taverna.t2/maelstrom-impl
public void testLockUnlock() throws UnsupportedEncodingException,
MalformedIdentifierException, ActivityConfigurationException,
EditException, InterruptedException {
testLock();
System.out.println("Unlock (should produce both tokens) :");
Thread.sleep(200);
WorkflowDataToken token2 = new WorkflowDataToken("outerProcess1",
new int[0], Literal.buildLiteral("Another string"),context);
p1.getInputPorts().get(0).receiveEvent(token2);
assertTrue(deh2.getEventCount() == 1);
}
代码示例来源:origin: net.sf.taverna.t2/maelstrom-impl
public void testLock() throws UnsupportedEncodingException,
MalformedIdentifierException, ActivityConfigurationException,
EditException {
create();
System.out.println("Lock (should produce no output) :");
WorkflowDataToken token = new WorkflowDataToken("outerProcess1",
new int[0], Literal.buildLiteral("A string"), context);
p2.getInputPorts().get(0).receiveEvent(token);
// p1.getInputPorts().get(0).receiveEvent(token);
assertTrue(deh2.getEventCount() == 0);
}
代码示例来源:origin: net.sf.taverna.t2/maelstrom-impl
public void testLockUnlockWithDifferentProcess()
throws UnsupportedEncodingException, MalformedIdentifierException,
ActivityConfigurationException, EditException, InterruptedException {
testLock();
System.out.println("Unlock with diffent process, only output from p1 :");
Thread.sleep(200);
WorkflowDataToken token2 = new WorkflowDataToken("outerProcess2",
new int[0], Literal.buildLiteral("Another string"),context);
p1.getInputPorts().get(0).receiveEvent(token2);
assertTrue(deh2.getEventCount() == 0);
assertTrue(deh1.getEventCount() == 1);
}
代码示例来源:origin: net.sf.taverna.t2/compatibility-impl
@SuppressWarnings("null")
@Test
public void testBoundPortOverridesDefault() throws Exception {
Dataflow dataflow = loadAndTranslateWorkflow("bound_port_overides_default.xml");
assertEquals("there should only be 2 processors",2,dataflow.getProcessors().size());
Processor processor_A=null;
Processor processor_B=null;
for (Processor p : dataflow.getProcessors()) {
if (p.getLocalName().equals("Processor_A")) processor_A=p;
if (p.getLocalName().equals("Processor_B")) processor_B=p;
}
assertNotNull("Could not find processor A",processor_A);
assertNotNull("Could not find processor B",processor_B);
assertEquals("processor_A should have no inputs",0,processor_A.getInputPorts().size());
assertEquals("processor_A should have 1 output",1,processor_A.getOutputPorts().size());
assertEquals("processor_B should have 1 input",1,processor_B.getInputPorts().size());
assertEquals("processor_B should have 1 input named input_1","input_1",processor_B.getInputPorts().get(0).getName());
assertEquals("processor_B should have 1 output",1,processor_B.getOutputPorts().size());
assertEquals("processor_B should have 1 activity",1,processor_B.getActivityList().size());
Activity<?>activity = processor_B.getActivityList().get(0);
assertEquals("activity should have 3 input ports",3,activity.getInputPorts().size());
}
代码示例来源:origin: net.sf.taverna.t2.compatibility/compatibility-impl
@SuppressWarnings("null")
@Test
public void testBoundPortOverridesDefault() throws Exception {
Dataflow dataflow = loadAndTranslateWorkflow("bound_port_overides_default.xml");
assertEquals("there should only be 2 processors",2,dataflow.getProcessors().size());
Processor processor_A=null;
Processor processor_B=null;
for (Processor p : dataflow.getProcessors()) {
if (p.getLocalName().equals("Processor_A")) processor_A=p;
if (p.getLocalName().equals("Processor_B")) processor_B=p;
}
assertNotNull("Could not find processor A",processor_A);
assertNotNull("Could not find processor B",processor_B);
assertEquals("processor_A should have no inputs",0,processor_A.getInputPorts().size());
assertEquals("processor_A should have 1 output",1,processor_A.getOutputPorts().size());
assertEquals("processor_B should have 1 input",1,processor_B.getInputPorts().size());
assertEquals("processor_B should have 1 input named input_1","input_1",processor_B.getInputPorts().get(0).getName());
assertEquals("processor_B should have 1 output",1,processor_B.getOutputPorts().size());
assertEquals("processor_B should have 1 activity",1,processor_B.getActivityList().size());
Activity<?>activity = processor_B.getActivityList().get(0);
assertEquals("activity should have 3 input ports",3,activity.getInputPorts().size());
}
代码示例来源:origin: net.sf.taverna.t2/compatibility-impl
@SuppressWarnings("null")
@Test
public void testRemovalOfUnboundPorts() throws Exception {
Dataflow dataflow = loadAndTranslateWorkflow("unbound_ports.xml");
Processor processor_A=null;
Processor processor_B=null;
assertEquals("there should only be 2 processors",2,dataflow.getProcessors().size());
for (Processor p : dataflow.getProcessors()) {
if (p.getLocalName().equals("Processor_A")) processor_A=p;
if (p.getLocalName().equals("Processor_B")) processor_B=p;
}
assertNotNull("Could not find processor A",processor_A);
assertNotNull("Could not find processor B",processor_B);
assertEquals("processor_A should have no inputs",0,processor_A.getInputPorts().size());
assertEquals("processor_A should have 1 output",1,processor_A.getOutputPorts().size());
assertEquals("processor_B should have 1 input",1,processor_B.getInputPorts().size());
assertEquals("processor_B should have 1 input named input_1","input_1",processor_B.getInputPorts().get(0).getName());
assertEquals("processor_B should have 1 output",1,processor_B.getOutputPorts().size());
assertEquals("processor_B should have 1 activity",1,processor_B.getActivityList().size());
Activity<?>activity = processor_B.getActivityList().get(0);
assertEquals("activity should have 3 input ports",3,activity.getInputPorts().size());
}
代码示例来源:origin: net.sf.taverna.t2/cyclone-impl
@SuppressWarnings("null")
@Test
public void testRemovalOfUnboundPorts() throws Exception {
Dataflow dataflow = loadAndTranslateWorkflow("unbound_ports.xml");
Processor processor_A=null;
Processor processor_B=null;
assertEquals("there should only be 2 processors",2,dataflow.getProcessors().size());
for (Processor p : dataflow.getProcessors()) {
if (p.getLocalName().equals("Processor_A")) processor_A=p;
if (p.getLocalName().equals("Processor_B")) processor_B=p;
}
assertNotNull("Could not find processor A",processor_A);
assertNotNull("Could not find processor B",processor_B);
assertEquals("processor_A should have no inputs",0,processor_A.getInputPorts().size());
assertEquals("processor_A should have 1 output",1,processor_A.getOutputPorts().size());
assertEquals("processor_B should have 1 input",1,processor_B.getInputPorts().size());
assertEquals("processor_B should have 1 input named input_1","input_1",processor_B.getInputPorts().get(0).getName());
assertEquals("processor_B should have 1 output",1,processor_B.getOutputPorts().size());
assertEquals("processor_B should have 1 activity",1,processor_B.getActivityList().size());
Activity<?>activity = processor_B.getActivityList().get(0);
assertEquals("activity should have 3 input ports",3,activity.getInputPorts().size());
}
代码示例来源:origin: net.sf.taverna.t2/cyclone-impl
@SuppressWarnings("null")
@Test
public void testBoundPortOverridesDefault() throws Exception {
Dataflow dataflow = loadAndTranslateWorkflow("bound_port_overides_default.xml");
assertEquals("there should only be 2 processors",2,dataflow.getProcessors().size());
Processor processor_A=null;
Processor processor_B=null;
for (Processor p : dataflow.getProcessors()) {
if (p.getLocalName().equals("Processor_A")) processor_A=p;
if (p.getLocalName().equals("Processor_B")) processor_B=p;
}
assertNotNull("Could not find processor A",processor_A);
assertNotNull("Could not find processor B",processor_B);
assertEquals("processor_A should have no inputs",0,processor_A.getInputPorts().size());
assertEquals("processor_A should have 1 output",1,processor_A.getOutputPorts().size());
assertEquals("processor_B should have 1 input",1,processor_B.getInputPorts().size());
assertEquals("processor_B should have 1 input named input_1","input_1",processor_B.getInputPorts().get(0).getName());
assertEquals("processor_B should have 1 output",1,processor_B.getOutputPorts().size());
assertEquals("processor_B should have 1 activity",1,processor_B.getActivityList().size());
Activity<?>activity = processor_B.getActivityList().get(0);
assertEquals("activity should have 3 input ports",3,activity.getInputPorts().size());
}
内容来源于网络,如有侵权,请联系作者删除!