public PortNode(IterationStrategyParent parent, InputProcessorPort inputProcessorPort) { setParent(parent); setInputProcessorPort(inputProcessorPort); }
/** * Sets the <code>IterationStrategyStack</code>. * * @param iterationStrategyStack * the <code>IterationStrategyStack</code>. Can be * <code>null</code> */ public void setIterationStrategyStack( IterationStrategyStack iterationStrategyStack) { this.iterationStrategyStack = iterationStrategyStack; if (iterationStrategyStack != null) iterationStrategyStack.setParent(this); }
private Integer getPortNodeIterationDepth(PortNode portNode, Map<InputProcessorPort, Integer> inputDepths) { int myInputDepth = inputDepths.get(portNode.getInputProcessorPort()); int depthMismatch = myInputDepth - portNode.getDesiredDepth(); return (depthMismatch > 0 ? depthMismatch : 0); }
@Override protected void cloneInto(WorkflowBean clone, Cloning cloning) { PortNode cloneNode = (PortNode)clone; cloneNode.setDesiredDepth(getDesiredDepth()); cloneNode.setInputProcessorPort(cloning.cloneOrOriginal(getInputProcessorPort())); }
public IterationStrategyStack makeIterationStrategyStack( InputProcessorPort... inputs) { IterationStrategyStack stack = new IterationStrategyStack(); CrossProduct crossProduct = new CrossProduct(); crossProduct.setParent(stack); for (InputProcessorPort inp : inputs) { PortNode n = new PortNode(crossProduct, inp); n.setDesiredDepth(0); } return stack; }
@Test public void simpleCrossProduct() throws Exception { assertEquals(1, coloursLisr.getIterationStrategyStack().size()); IterationStrategyTopNode top = coloursLisr.getIterationStrategyStack().get(0); assertTrue(top instanceof CrossProduct); assertEquals(1, top.size()); IterationStrategyNode node = top.get(0); assertTrue(node instanceof PortNode); PortNode portNode = (PortNode) node; assertEquals(0, portNode.getDesiredDepth().intValue()); assertEquals(coloursLisr.getInputPorts().getByName("string"), portNode.getInputProcessorPort()); }
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; }
@Test public void dotProductNotEqual() throws Exception { DotProduct dotProd1 = new DotProduct(); DotProduct dotProd2 = new DotProduct(); dotProd2.add(new PortNode()); assertNotEquals(dotProd1, dotProd2); }
@Test public void crossProductNotEqual() throws Exception { CrossProduct crossProd1 = new CrossProduct(); CrossProduct crossProd2 = new CrossProduct(); crossProd2.add(new PortNode()); assertNotEquals(crossProd1, crossProd2); }
@Test public void iterationStackNotEqualToCrossProduct() throws Exception { IterationStrategyStack itStack = new IterationStrategyStack(); CrossProduct crossProd = new CrossProduct(); assertNotEquals(itStack, crossProd); }
@Test public void iterationStackNotEqualToDotProduct() throws Exception { IterationStrategyStack itStack = new IterationStrategyStack(); DotProduct dotProd = new DotProduct(); assertNotEquals(itStack, dotProd); } }
@Test public void crossProductNotEqualToDotProduct() throws Exception { DotProduct dotProd = new DotProduct(); CrossProduct crossProd = new CrossProduct(); assertNotEquals(crossProd, dotProd); assertNotEquals(dotProd, crossProd); }
@Override public boolean accept(Visitor visitor) { if (visitor.visitEnter(this)) for (IterationStrategyNode strategy : this) if (!strategy.accept(visitor)) break; return visitor.visitLeave(this); }
/** * Get the URI of this port node relative to another workflow element. * * @return The relative URI. * @see URITools#relativeUriForBean(WorkflowBean,WorflowBean) */ public URI getRelativeURI(WorkflowBean relativeTo) { return getUriTools().relativeUriForBean(this, relativeTo); } }
@Override public boolean accept(Visitor visitor) { if (visitor.visitEnter(this)) for (IterationStrategyTopNode strategy : this) if (!strategy.accept(visitor)) break; return visitor.visitLeave(this); }
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 IterationStrategyStack(Processor parent) { setParent(parent); }
@Override public boolean accept(Visitor visitor) { if (visitor.visitEnter(this)) for (IterationStrategyNode strategy : this) if (!strategy.accept(visitor)) break; return visitor.visitLeave(this); }