@SuppressWarnings("boxing") protected Set<InputProcessorPort> parseProcessorInputPorts( Processor newProc, DepthPorts origPorts) { Set<InputProcessorPort> newPorts = new HashSet<>(); for (DepthPort origPort : origPorts.getPort()) { InputProcessorPort newPort = new InputProcessorPort(newProc, origPort.getName()); newPort.setDepth(origPort.getDepth().intValue()); // TODO: What about InputProcessorPort granular depth? newPorts.add(newPort); } return newPorts; }
private InputProcessorPort findOrCreateProcessorInputPort(Processor p, String name, Integer depth) { InputProcessorPort port = p.getInputPorts().getByName(name); if (port == null) { port = new InputProcessorPort(); port.setParent(p); port.setName(name); port.setDepth(depth); } return port; }
protected void processorInputProcessorPort( org.apache.taverna.scufl2.xml.InputProcessorPort original) { org.apache.taverna.scufl2.api.port.InputProcessorPort port = new org.apache.taverna.scufl2.api.port.InputProcessorPort(); port.setName(original.getName()); if (original.getPortDepth() != null) port.setDepth(original.getPortDepth().getValue()); port.setParent(getParserState().getCurrent(Processor.class)); mapBean(getParserState().getCurrentBase().resolve(original.getAbout()), port); }
private DotProduct getDot(int depthA, int depthB) { a = new InputProcessorPort(); a.setName("a"); a.setDepth(0); DotProduct dp = new DotProduct(); PortNode nipn1 = new PortNode(dp, a); nipn1.setDesiredDepth(depthA); b = new InputProcessorPort(); b.setName("b"); b.setDepth(0); PortNode nipn2 = new PortNode(dp, b); nipn2.setDesiredDepth(depthB); return dp; }
private CrossProduct getCross(int depthA, int depthB) { a = new InputProcessorPort(); a.setName("a"); a.setDepth(0); CrossProduct cp = new CrossProduct(); PortNode nipn1 = new PortNode(cp, a); nipn1.setDesiredDepth(depthA); b = new InputProcessorPort(); b.setName("b"); b.setDepth(0); PortNode nipn2 = new PortNode(cp, b); nipn2.setDesiredDepth(depthB); return cp; }
public void createProcessorPortsFromActivity(Processor processor, Activity activity) { for (InputActivityPort activityPort : activity.getInputPorts()) new InputProcessorPort(processor, activityPort.getName()) .setDepth(activityPort.getDepth()); for (OutputActivityPort activityPort : activity.getOutputPorts()) { OutputProcessorPort procPort = new OutputProcessorPort(processor, activityPort.getName()); procPort.setDepth(activityPort.getDepth()); procPort.setGranularDepth(activityPort.getGranularDepth()); } }
private CrossProduct getCross(int depthA, int depthB) { a = new InputProcessorPort(); a.setName("a"); a.setDepth(0); CrossProduct cp = new CrossProduct(); PortNode nipn1 = new PortNode(cp, a); nipn1.setDesiredDepth(depthA); b = new InputProcessorPort(); b.setName("b"); b.setDepth(0); PortNode nipn2 = new PortNode(cp, b); nipn2.setDesiredDepth(depthB); return cp; }
private DotProduct getDot(int depthA, int depthB) { a = new InputProcessorPort(); a.setName("a"); a.setDepth(0); DotProduct dp = new DotProduct(); PortNode nipn1 = new PortNode(dp, a); nipn1.setDesiredDepth(depthA); b = new InputProcessorPort(); b.setName("b"); b.setDepth(0); PortNode nipn2 = new PortNode(dp, b); nipn2.setDesiredDepth(depthB); return dp; }
public Processor makeProcessor() { processor = new Processor(workflow, "Hello"); processorName = new InputProcessorPort(processor, "name"); processorName.setDepth(0); processorGreeting = new OutputProcessorPort(processor, "greeting"); processorGreeting.setDepth(0); processorGreeting.setGranularDepth(0); // FIXME: Should not need to make default iteration stack makeIterationStrategyStack(processorName).setParent(processor); return processor; }
@Test public void testSimpleIteration() { WorkflowBundle wb = new WorkflowBundle(); Workflow w = new Workflow(); wb.setMainWorkflow(w); InputWorkflowPort a = new InputWorkflowPort(w, "a"); a.setDepth(1); Processor p = new Processor(w, "p"); InputProcessorPort ipp = new InputProcessorPort(p, "in"); ipp.setDepth(0); OutputProcessorPort opp = new OutputProcessorPort(p, "out"); opp.setDepth(3); DataLink inLink = new DataLink(w, a, ipp); IterationStrategyStack iss = new IterationStrategyStack(p); CrossProduct cp = new CrossProduct(); iss.add(cp); PortNode portNode = new PortNode(cp, ipp); portNode.setDesiredDepth(0); StructuralValidator sv = new StructuralValidator(); ReportStructuralValidationListener l = new ReportStructuralValidationListener(); sv.checkStructure(wb, l); ValidatorState vs = sv.getValidatorState(); assertEquals(0, l.getIncompleteWorkflows().size()); assertEquals(Integer.valueOf(1), vs.getPortResolvedDepth(a)); assertEquals(Integer.valueOf(1), vs.getDataLinkResolvedDepth(inLink)); assertEquals(Integer.valueOf(1), vs.getPortResolvedDepth(ipp)); assertEquals(Integer.valueOf(4), vs.getPortResolvedDepth(opp)); }
@Test public void createActivityFromProcessor() throws Exception { Processor p = new Processor(); new InputProcessorPort(p, "in1"); new InputProcessorPort(p, "in2").setDepth(1); new OutputProcessorPort(p, "out1"); new OutputProcessorPort(p, "out2").setDepth(0); OutputProcessorPort pOut3 = new OutputProcessorPort(p, "out3"); pOut3.setDepth(2); pOut3.setGranularDepth(1); Profile profile = new Profile(); Activity a = scufl2Tools.createActivityFromProcessor(p, profile); assertEquals(profile, a.getParent()); ProcessorBinding binding = scufl2Tools.processorBindingForProcessor(p, profile); assertEquals(2, a.getInputPorts().size()); assertEquals(3, a.getOutputPorts().size()); assertEquals(2, binding.getInputPortBindings().size()); assertEquals(3, binding.getOutputPortBindings().size()); assertEquals(a, binding.getBoundActivity()); assertEquals(p, binding.getBoundProcessor()); }
Processor p = new Processor(); new InputProcessorPort(p, "in1"); new InputProcessorPort(p, "in2").setDepth(1);