当前位置: 首页>>代码示例>>Java>>正文


Java IterationStrategyStack.add方法代码示例

本文整理汇总了Java中org.apache.taverna.scufl2.api.iterationstrategy.IterationStrategyStack.add方法的典型用法代码示例。如果您正苦于以下问题:Java IterationStrategyStack.add方法的具体用法?Java IterationStrategyStack.add怎么用?Java IterationStrategyStack.add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.taverna.scufl2.api.iterationstrategy.IterationStrategyStack的用法示例。


在下文中一共展示了IterationStrategyStack.add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testStagedCombinationOfDot1

import org.apache.taverna.scufl2.api.iterationstrategy.IterationStrategyStack; //导入方法依赖的package包/类
@Test
	public void testStagedCombinationOfDot1() {
		
		Processor p = new Processor();
		IterationStrategyStack iss = new IterationStrategyStack(p);

	iss.add(getDot(1, 1));
	iss.add(getDot(0, 0));
	StructuralValidator sv = new StructuralValidator();
	sv.getValidatorState().setProcessor(p);
	Map<InputProcessorPort, Integer> tempDepths = new HashMap<InputProcessorPort, Integer>();
	tempDepths.put(a,2);
	tempDepths.put(b,2);

	assertEquals(Integer.valueOf(2), sv.calculateResultWrappingDepth(tempDepths));

}
 
开发者ID:apache,项目名称:incubator-taverna-language,代码行数:18,代码来源:DotProductTest.java

示例2: testStagedCombinationOfDot2

import org.apache.taverna.scufl2.api.iterationstrategy.IterationStrategyStack; //导入方法依赖的package包/类
@Test
	public void testStagedCombinationOfDot2() {
		
		Processor p = new Processor();
		IterationStrategyStack iss = new IterationStrategyStack(p);

	iss.add(getDot(1, 1));
	iss.add(getDot(0, 0));
	StructuralValidator sv = new StructuralValidator();
	sv.getValidatorState().setProcessor(p);
	Map<InputProcessorPort, Integer> tempDepths = new HashMap<InputProcessorPort, Integer>();
	tempDepths.put(a,0);
	tempDepths.put(b,0);

	// Should pass because the single items (depth 0) are promoted to single
	// item lists before being passed into the iteration system so are
	// effectively both depth 1 going into the second stage which then
	// iterates to produce an index array length of 1
	assertEquals(Integer.valueOf(1), sv.calculateResultWrappingDepth(tempDepths));

}
 
开发者ID:apache,项目名称:incubator-taverna-language,代码行数:22,代码来源:DotProductTest.java

示例3: testStagedCombinationOfDot3

import org.apache.taverna.scufl2.api.iterationstrategy.IterationStrategyStack; //导入方法依赖的package包/类
@Test
	public void testStagedCombinationOfDot3() {
		
		Processor p = new Processor();
		IterationStrategyStack iss = new IterationStrategyStack(p);

	iss.add(getDot(1, 1));
	iss.add(getDot(0, 0));
	StructuralValidator sv = new StructuralValidator();
	sv.getValidatorState().setProcessor(p);
	Map<InputProcessorPort, Integer> tempDepths = new HashMap<InputProcessorPort, Integer>();
	tempDepths.put(a,1);
	tempDepths.put(b,0);

	// Slightly strange superficially that this should work, but in fact
	// what happens is that the first single item is lifted to a list before
	// being passed to the iteration strategy. The result is that it's fine
	// to match with the dot product against the other list as neither at
	// this point have index arrays, then in the second stage both are lists
	// to be iterated over and both have single length index arrays.
	assertEquals(Integer.valueOf(1), sv.calculateResultWrappingDepth(tempDepths));

}
 
开发者ID:apache,项目名称:incubator-taverna-language,代码行数:24,代码来源:DotProductTest.java

示例4: testStagedCombinationOfCross

import org.apache.taverna.scufl2.api.iterationstrategy.IterationStrategyStack; //导入方法依赖的package包/类
@Test
	public void testStagedCombinationOfCross() {
		
		Processor p = new Processor();
		IterationStrategyStack iss = new IterationStrategyStack(p);

	iss.add(getCross(1, 1));
	iss.add(getCross(0, 0));
	StructuralValidator sv = new StructuralValidator();
	sv.getValidatorState().setProcessor(p);
	Map<InputProcessorPort, Integer> tempDepths = new HashMap<InputProcessorPort, Integer>();
	tempDepths.put(a,2);
	tempDepths.put(b,2);

	assertEquals(Integer.valueOf(4), sv.calculateResultWrappingDepth(tempDepths));

}
 
开发者ID:apache,项目名称:incubator-taverna-language,代码行数:18,代码来源:CrossProductTest.java

示例5: testStagedCombinationOfDotAndCross

import org.apache.taverna.scufl2.api.iterationstrategy.IterationStrategyStack; //导入方法依赖的package包/类
/**
 * Test whether Paul's example of iterating with dot product then cross
 * product can typecheck in a single staged iteration. This was an example
 * where the user had two lists of folders (a1, a2, b1, b2, c1, c2) and
 * wanted to compare all the contents of each 'a' folder with the other 'a'
 * folder and so on, doing a dot match to only compare a1 and a2 then a
 * cross product join within each pair to compare all contents of a1 with
 * all contents of a2. This appears to work!
 */
@Test
public void testStagedCombinationOfDotAndCross() {
	Processor p = new Processor();
	IterationStrategyStack iss = new IterationStrategyStack(p);
	iss.add(getDot(1, 1));	
	iss.add(getCross(0, 0));
	
	StructuralValidator sv = new StructuralValidator();
	sv.getValidatorState().setProcessor(p);
	Map<InputProcessorPort, Integer> tempDepths = new HashMap<InputProcessorPort, Integer>();
	tempDepths.put(a,2);
	tempDepths.put(b,2);

	assertEquals(Integer.valueOf(3), sv.calculateResultWrappingDepth(tempDepths));
}
 
开发者ID:apache,项目名称:incubator-taverna-language,代码行数:25,代码来源:StagedCombinationTest.java

示例6: testInScopeInputProcessorPort

import org.apache.taverna.scufl2.api.iterationstrategy.IterationStrategyStack; //导入方法依赖的package包/类
@Test
public void testInScopeInputProcessorPort() {
	Processor p = new Processor();
	InputProcessorPort ipp = new InputProcessorPort();
	ipp.setParent(p);
	IterationStrategyStack iss = new IterationStrategyStack();
	p.setIterationStrategyStack(iss);
	CrossProduct cp = new CrossProduct();
	iss.add(cp);
	cp.setParent(iss);
	PortNode pn = new PortNode();
	pn.setInputProcessorPort(ipp);
	cp.add(pn);
	pn.setParent(cp);
	
	CorrectnessValidator cv = new CorrectnessValidator();
	ReportCorrectnessValidationListener rcvl = new ReportCorrectnessValidationListener();
	
	cv.checkCorrectness(pn, false, rcvl);
	
	Set<OutOfScopeValueProblem> outOfScopeValueProblems = rcvl.getOutOfScopeValueProblems();
	assertEquals(Collections.EMPTY_SET, outOfScopeValueProblems);
	
}
 
开发者ID:apache,项目名称:incubator-taverna-language,代码行数:25,代码来源:TestPortNode.java

示例7: parseIterationStrategyStack

import org.apache.taverna.scufl2.api.iterationstrategy.IterationStrategyStack; //导入方法依赖的package包/类
protected IterationStrategyStack parseIterationStrategyStack(
		org.apache.taverna.scufl2.xml.t2flow.jaxb.IterationStrategyStack originalStack)
		throws ReaderException {
	IterationStrategyStack newStack = new IterationStrategyStack();

	for (TopIterationNode strategy : originalStack.getIteration()
			.getStrategy()) {
		IterationNode topNode = strategy.getCross();
		if (topNode == null)
			topNode = strategy.getDot();
		if (topNode == null)
			continue;
		IterationNodeParent parent = (IterationNodeParent) topNode;
		if (parent.getCrossOrDotOrPort().isEmpty())
			continue;
		try {
			newStack.add((IterationStrategyTopNode) parseIterationStrategyNode(topNode));
		} catch (ReaderException e) {
			if (isStrict())
				throw e;
			logger.warning(e.getMessage());
		}
	}

	return newStack;
}
 
开发者ID:apache,项目名称:incubator-taverna-language,代码行数:27,代码来源:T2FlowParser.java

示例8: testSimpleIteration

import org.apache.taverna.scufl2.api.iterationstrategy.IterationStrategyStack; //导入方法依赖的package包/类
@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));
}
 
开发者ID:apache,项目名称:incubator-taverna-language,代码行数:36,代码来源:DepthInheritanceTest.java

示例9: testValidIterationStrategyStack

import org.apache.taverna.scufl2.api.iterationstrategy.IterationStrategyStack; //导入方法依赖的package包/类
@Test
public void testValidIterationStrategyStack() {
	Processor p = new Processor();
	IterationStrategyStack iss = new IterationStrategyStack();
	iss.setParent(p);
	
	InputProcessorPort p1 = new InputProcessorPort();
	p1.setParent(p);
	InputProcessorPort p2 = new InputProcessorPort();
	p2.setParent(p);
	InputProcessorPort p3 = new InputProcessorPort();
	p3.setParent(p);	
	
	CrossProduct cp = new CrossProduct();
	PortNode pNode1 = new PortNode();
	pNode1.setInputProcessorPort(p1);
	cp.add(pNode1);
	iss.add(cp);
	
	DotProduct dp = new DotProduct();
	PortNode pNode2 = new PortNode();
	pNode2.setInputProcessorPort(p2);
	PortNode pNode3 = new PortNode();
	pNode3.setInputProcessorPort(p3);
	dp.add(pNode2);
	dp.add(pNode3);
	iss.add(dp);
	
	CorrectnessValidator cv = new CorrectnessValidator();
	ReportCorrectnessValidationListener rcvl = new ReportCorrectnessValidationListener();
	
	cv.checkCorrectness(p, true, rcvl);
	
	Set<PortMissingFromIterationStrategyStackProblem> problems = rcvl.getPortMissingFromIterationStrategyStackProblems();
	assertEquals(Collections.EMPTY_SET, problems);

}
 
开发者ID:apache,项目名称:incubator-taverna-language,代码行数:38,代码来源:TestIterationStrategyStack.java

示例10: testOutOfScopeInputProcessorPort

import org.apache.taverna.scufl2.api.iterationstrategy.IterationStrategyStack; //导入方法依赖的package包/类
@Test
	public void testOutOfScopeInputProcessorPort() {
		Processor p = new Processor();
		InputProcessorPort ipp = new InputProcessorPort();
//		ipp.setParent(p);
		IterationStrategyStack iss = new IterationStrategyStack();
		p.setIterationStrategyStack(iss);
		CrossProduct cp = new CrossProduct();
		iss.add(cp);
		cp.setParent(iss);
		PortNode pn = new PortNode();
		pn.setInputProcessorPort(ipp);
		cp.add(pn);
		pn.setParent(cp);
		
		CorrectnessValidator cv = new CorrectnessValidator();
		ReportCorrectnessValidationListener rcvl = new ReportCorrectnessValidationListener();
		
		cv.checkCorrectness(pn, false, rcvl);
		
		Set<OutOfScopeValueProblem> outOfScopeValueProblems = rcvl.getOutOfScopeValueProblems();
		assertFalse(outOfScopeValueProblems.isEmpty());
		
		boolean problem = false;
		for (OutOfScopeValueProblem nlp : outOfScopeValueProblems) {
			if (nlp.getBean().equals(pn) && nlp.getFieldName().equals("inputProcessorPort") && nlp.getValue().equals(ipp)) {
				problem = true;
			}
		}
		assertTrue(problem);
		
	}
 
开发者ID:apache,项目名称:incubator-taverna-language,代码行数:33,代码来源:TestPortNode.java

示例11: testValidIterationStrategyTopNode

import org.apache.taverna.scufl2.api.iterationstrategy.IterationStrategyStack; //导入方法依赖的package包/类
@Test
public void testValidIterationStrategyTopNode() {
	Processor p = new Processor();
	IterationStrategyStack iss = new IterationStrategyStack();
	iss.setParent(p);
	
	InputProcessorPort p1 = new InputProcessorPort();
	p1.setParent(p);
	InputProcessorPort p2 = new InputProcessorPort();
	p2.setParent(p);
	InputProcessorPort p3 = new InputProcessorPort();
	p3.setParent(p);	
	
	// Do a crossproduct with a portnode and a dotproduct
	CrossProduct cp = new CrossProduct();
	PortNode pNode1 = new PortNode();
	pNode1.setInputProcessorPort(p1);
	cp.add(pNode1);
	iss.add(cp);
	
	DotProduct dp = new DotProduct();
	PortNode pNode2 = new PortNode();
	pNode2.setInputProcessorPort(p2);
	PortNode pNode3 = new PortNode();
	pNode3.setInputProcessorPort(p3);
	dp.add(pNode2);
	dp.add(pNode3);
	cp.add(dp);
	
	CorrectnessValidator cv = new CorrectnessValidator();
	ReportCorrectnessValidationListener rcvl = new ReportCorrectnessValidationListener();
	
	cv.checkCorrectness(p, false, rcvl);
	
	Set<PortMentionedTwiceProblem> problems = rcvl.getPortMentionedTwiceProblems();
	assertEquals(Collections.EMPTY_SET, problems);

}
 
开发者ID:apache,项目名称:incubator-taverna-language,代码行数:39,代码来源:TestIterationStrategyTopNode.java

示例12: testInvalidIterationStrategyStack

import org.apache.taverna.scufl2.api.iterationstrategy.IterationStrategyStack; //导入方法依赖的package包/类
@Test
public void testInvalidIterationStrategyStack() {
	Processor p = new Processor();
	IterationStrategyStack iss = new IterationStrategyStack();
	iss.setParent(p);
	
	InputProcessorPort p1 = new InputProcessorPort();
	p1.setParent(p);
	InputProcessorPort p2 = new InputProcessorPort();
	p2.setParent(p);
	InputProcessorPort p3 = new InputProcessorPort();
	p3.setParent(p);	
	
	CrossProduct cp = new CrossProduct();
	PortNode pNode1 = new PortNode();
	pNode1.setInputProcessorPort(p1);
	cp.add(pNode1);
	iss.add(cp);
	
	DotProduct dp = new DotProduct();
	PortNode pNode2 = new PortNode();
	pNode2.setInputProcessorPort(p2);
	dp.add(pNode2);
	iss.add(dp);
	
	CorrectnessValidator cv = new CorrectnessValidator();
	ReportCorrectnessValidationListener rcvl = new ReportCorrectnessValidationListener();
	
	cv.checkCorrectness(p, true, rcvl);
	
	Set<PortMissingFromIterationStrategyStackProblem> problems = rcvl.getPortMissingFromIterationStrategyStackProblems();
	assertFalse(problems.isEmpty());

	boolean problem = false;
	for (PortMissingFromIterationStrategyStackProblem nlp : problems) {
		if (nlp.getPort().equals(p3) && nlp.getBean().equals(iss)) {
			problem = true;
		}
	}
	assertTrue(problem);
}
 
开发者ID:apache,项目名称:incubator-taverna-language,代码行数:42,代码来源:TestIterationStrategyStack.java

示例13: testInvalidAtTopIterationStrategyTopNode

import org.apache.taverna.scufl2.api.iterationstrategy.IterationStrategyStack; //导入方法依赖的package包/类
@Test
public void testInvalidAtTopIterationStrategyTopNode() {
	Processor p = new Processor();
	IterationStrategyStack iss = new IterationStrategyStack();
	iss.setParent(p);
	
	InputProcessorPort p1 = new InputProcessorPort();
	p1.setParent(p);
	InputProcessorPort p2 = new InputProcessorPort();
	p2.setParent(p);
	InputProcessorPort p3 = new InputProcessorPort();
	p3.setParent(p);	
	
	// Do a crossproduct with a portnode and a dotproduct
	CrossProduct cp = new CrossProduct();
	PortNode pNode1 = new PortNode();
	pNode1.setInputProcessorPort(p1);
	cp.add(pNode1);
	PortNode duplicateNode = new PortNode();
	duplicateNode.setInputProcessorPort(p1);
	cp.add(duplicateNode);
	iss.add(cp);
	
	DotProduct dp = new DotProduct();
	PortNode pNode2 = new PortNode();
	pNode2.setInputProcessorPort(p2);
	PortNode pNode3 = new PortNode();
	pNode3.setInputProcessorPort(p3);
	dp.add(pNode2);
	dp.add(pNode3);
	cp.add(dp);
	
	CorrectnessValidator cv = new CorrectnessValidator();
	ReportCorrectnessValidationListener rcvl = new ReportCorrectnessValidationListener();
	
	cv.checkCorrectness(p, false, rcvl);
	
	Set<PortMentionedTwiceProblem> problems = rcvl.getPortMentionedTwiceProblems();
	assertFalse(problems.isEmpty());
	boolean problemDetected = false;
	for (PortMentionedTwiceProblem problem : problems) {
		if (problem.getBean().equals(pNode1) && problem.getDuplicateNode().equals(duplicateNode)) {
			problemDetected = true;
		}
	}
	assertTrue(problemDetected);

}
 
开发者ID:apache,项目名称:incubator-taverna-language,代码行数:49,代码来源:TestIterationStrategyTopNode.java

示例14: testInvalidDeepInIterationStrategyTopNode

import org.apache.taverna.scufl2.api.iterationstrategy.IterationStrategyStack; //导入方法依赖的package包/类
@Test
public void testInvalidDeepInIterationStrategyTopNode() {
	Processor p = new Processor();
	IterationStrategyStack iss = new IterationStrategyStack();
	iss.setParent(p);
	
	InputProcessorPort p1 = new InputProcessorPort();
	p1.setParent(p);
	InputProcessorPort p2 = new InputProcessorPort();
	p2.setParent(p);
	InputProcessorPort p3 = new InputProcessorPort();
	p3.setParent(p);	
	
	// Do a crossproduct with a portnode and a dotproduct
	CrossProduct cp = new CrossProduct();
	PortNode pNode1 = new PortNode();
	pNode1.setInputProcessorPort(p1);
	cp.add(pNode1);
	iss.add(cp);
	
	DotProduct dp = new DotProduct();
	PortNode pNode2 = new PortNode();
	pNode2.setInputProcessorPort(p2);
	PortNode pNode3 = new PortNode();
	pNode3.setInputProcessorPort(p3);
	dp.add(pNode2);
	dp.add(pNode3);
	PortNode duplicateNode = new PortNode();
	duplicateNode.setInputProcessorPort(p1);
	cp.add(duplicateNode);
	cp.add(dp);
	
	CorrectnessValidator cv = new CorrectnessValidator();
	ReportCorrectnessValidationListener rcvl = new ReportCorrectnessValidationListener();
	
	cv.checkCorrectness(p, false, rcvl);
	
	Set<PortMentionedTwiceProblem> problems = rcvl.getPortMentionedTwiceProblems();
	assertFalse(problems.isEmpty());
	boolean problemDetected = false;
	for (PortMentionedTwiceProblem problem : problems) {
		if (problem.getBean().equals(pNode1) && problem.getDuplicateNode().equals(duplicateNode)) {
			problemDetected = true;
		}
	}
	assertTrue(problemDetected);

}
 
开发者ID:apache,项目名称:incubator-taverna-language,代码行数:49,代码来源:TestIterationStrategyTopNode.java

示例15: doEditAction

import org.apache.taverna.scufl2.api.iterationstrategy.IterationStrategyStack; //导入方法依赖的package包/类
@Override
public void doEditAction(IterationStrategyStack iterationStrategyStack) {
	iterationStrategyStack.add(iterationStrategyTopNode);
}
 
开发者ID:apache,项目名称:incubator-taverna-workbench,代码行数:5,代码来源:AddIterationStrategyEdit.java


注:本文中的org.apache.taverna.scufl2.api.iterationstrategy.IterationStrategyStack.add方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。