private void pushEvent( IterationInternalEvent<? extends IterationInternalEvent<?>> e) { if (stack != null) { IterationStrategyImpl below = stack .layerBelow(IterationStrategyImpl.this); if (below == null) { stack.receiveEventFromStrategy(e); } else { below.receiveEvent(e); } } }
public int getIterationDepth(Map<String, Integer> inputDepths) throws IterationTypeMismatchException { return getTerminal().getIterationDepth(inputDepths); }
@Override protected void pushCompletion(String portName, String owningProcess, int[] index, InvocationContext context) { parent.iterationStack.receiveCompletion(portName, owningProcess, index, context); }
public void testBasic() { NamedInputPortNode nipn = new NamedInputPortNode("Input", 0); DiagnosticIterationStrategyNode disn = new DiagnosticIterationStrategyNode(); nipn.setParent(disn); IterationStrategyImpl is = new IterationStrategyImpl(); is.addInput(nipn); try { is.receiveData("Input", "Process1", new int[]{}, nextID(), context); } catch (WorkflowStructureException e) { fail("Should be able to find input named 'Input' in this test case"); } assertTrue(disn.jobsReceived("Process1") == 1); }
public void configureFromElement(Element e) { strategies.clear(); for (Object child : e.getChildren("strategy",XMLSerializationConstants.T2_WORKFLOW_NAMESPACE)) { Element strategyElement = (Element) child; IterationStrategyImpl strategy = new IterationStrategyImpl(); strategy.configureFromXML(strategyElement); addStrategy(strategy); } }
/** * Fundamentally pointless, combining two cross product iteration strategies * is the same as using the last one directly but we can check this * * @throws IterationTypeMismatchException * @throws MissingIterationInputException */ public void testStagedCombinationOfCross() throws IterationTypeMismatchException, MissingIterationInputException { IterationStrategyStackImpl iss; iss = new IterationStrategyStackImpl(); iss.addStrategy(getISCross(1, 1)); iss.addStrategy(getISCross(0, 0)); assertTrue(iss.getIterationDepth(getDepths(new String[] { "a", "b" }, new int[] { 2, 2 })) == 4); }
public IterationStrategy createIterationStrategy() { return new IterationStrategyImpl(); }
/** * Test that attempting to typecheck a mismatched dot product produces a * type mismatch exception * */ public void testValidationFailureWithDot() { try { IterationStrategyImpl isi = getISDot(0, 0); isi.getIterationDepth(getDepths(new String[] { "a", "b" }, new int[] { 1, 2 })); fail("should have failed due to mismatch"); } catch (IterationTypeMismatchException itme) { // Correct behaviour, this should cause a mismatch } }
/** * Test simple iteration type check based on dot products * * @throws IterationTypeMismatchException */ public void testDotUnstagedIteration() throws IterationTypeMismatchException { IterationStrategyImpl isi = getISDot(0, 0); assertTrue(isi.getIterationDepth(getDepths(new String[] { "a", "b" }, new int[] { 1, 1 })) == 1); assertTrue(isi.getIterationDepth(getDepths(new String[] { "a", "b" }, new int[] { 2, 2 })) == 2); isi = getISDot(0, 1); assertTrue(isi.getIterationDepth(getDepths(new String[] { "a", "b" }, new int[] { 1, 2 })) == 1); }
/** * Test a simple iteration based on a cross product * * @throws IterationTypeMismatchException */ public void testCrossUnstagedIteration() throws IterationTypeMismatchException { IterationStrategyImpl isi = getISCross(0, 0); assertTrue(isi.getIterationDepth(getDepths(new String[] { "a", "b" }, new int[] { 1, 1 })) == 2); assertTrue(isi.getIterationDepth(getDepths(new String[] { "a", "b" }, new int[] { 2, 2 })) == 4); assertTrue(isi.getIterationDepth(getDepths(new String[] { "a", "b" }, new int[] { 1, 2 })) == 3); isi = getISCross(0, 1); assertTrue(isi.getIterationDepth(getDepths(new String[] { "a", "b" }, new int[] { 1, 2 })) == 2); }
@Override protected void pushData(String portName, String owningProcess, int[] index, T2Reference data, InvocationContext context) { parent.iterationStack.receiveData(portName, owningProcess, index, data, context); }
public void receiveBypassCompletion(Completion completion) { pushEvent(completion); }
public void configureFromElement(Element e) { strategies.clear(); for (Object child : e.getChildren("strategy")) { Element strategyElement = (Element) child; IterationStrategyImpl strategy = new IterationStrategyImpl(); strategy.configureFromXML(strategyElement); addStrategy(strategy); } }
private void pushEvent(IterationInternalEvent<? extends IterationInternalEvent<?>> e) { // System.out.println("Tnode : "+e); if (stack != null) { IterationStrategyImpl below = stack .layerBelow(IterationStrategyImpl.this); if (below == null) { stack.receiveEventFromStrategy(e); } else { below.receiveEvent(e); } } }
@Override protected void pushCompletion(String portName, String owningProcess, int[] index, InvocationContext context) { parent.iterationStack.receiveCompletion(portName, owningProcess, index, context); }
@Override protected void pushData(String portName, String owningProcess, int[] index, EntityIdentifier data, InvocationContext context) { parent.iterationStack.receiveData(portName, owningProcess, index, data, context); }
public void receiveBypassCompletion(Completion completion) { pushEvent(completion); }
private void pushEvent( IterationInternalEvent<? extends IterationInternalEvent<?>> e) { // System.out.println("Tnode : "+e); if (stack != null) { IterationStrategyImpl below = stack .layerBelow(IterationStrategyImpl.this); if (below == null) { stack.receiveEventFromStrategy(e); } else { below.receiveEvent(e); } } }
@Override protected void pushCompletion(String portName, String owningProcess, int[] index, InvocationContext context) { parent.iterationStack.receiveCompletion(portName, owningProcess, index, context); }
@Override protected void pushData(String portName, String owningProcess, int[] index, T2Reference data, InvocationContext context) { parent.iterationStack.receiveData(portName, owningProcess, index, data, context); }