本文整理汇总了Java中org.apache.taverna.scufl2.api.iterationstrategy.IterationStrategyNode类的典型用法代码示例。如果您正苦于以下问题:Java IterationStrategyNode类的具体用法?Java IterationStrategyNode怎么用?Java IterationStrategyNode使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
IterationStrategyNode类属于org.apache.taverna.scufl2.api.iterationstrategy包,在下文中一共展示了IterationStrategyNode类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getIterationDepth
import org.apache.taverna.scufl2.api.iterationstrategy.IterationStrategyNode; //导入依赖的package包/类
public Integer getIterationDepth(
IterationStrategyNode iterationStrategyNode,
Map<InputProcessorPort, Integer> inputDepths) {
if (iterationStrategyNode instanceof CrossProduct)
return getCrossProductIterationDepth(
(CrossProduct) iterationStrategyNode, inputDepths);
if (iterationStrategyNode instanceof DotProduct)
return getDotProductIterationDepth(
(DotProduct) iterationStrategyNode, inputDepths);
if (iterationStrategyNode instanceof PortNode)
return getPortNodeIterationDepth((PortNode) iterationStrategyNode,
inputDepths);
validatorState.get().getEventListener()
.unrecognizedIterationStrategyNode(iterationStrategyNode);
// validatorState.get().addUnrecognizedIterationStrategyNode(iterationStrategyNode);
validatorState.get().getEventListener()
.failedProcessorAdded(validatorState.get().getProcessor());
// validatorState.get().failCurrentProcessor();
return null;
}
示例2: getCrossProductIterationDepth
import org.apache.taverna.scufl2.api.iterationstrategy.IterationStrategyNode; //导入依赖的package包/类
private Integer getCrossProductIterationDepth(CrossProduct crossProduct,
Map<InputProcessorPort, Integer> inputDepths) {
if (crossProduct.isEmpty()) {
validatorState.get().getEventListener()
.emptyCrossProduct(crossProduct);
// validatorState.get().addEmptyCrossProduct(crossProduct);
validatorState.get().getEventListener()
.failedProcessorAdded(validatorState.get().getProcessor());
// validatorState.get().failCurrentProcessor();
return null;
}
int temp = 0;
for (IterationStrategyNode child : crossProduct) {
Integer childNodeDepth = getIterationDepth(child, inputDepths);
if (childNodeDepth == null)
return null;
temp += childNodeDepth;
}
return temp;
}
示例3: visitIterationStrategyTopNode
import org.apache.taverna.scufl2.api.iterationstrategy.IterationStrategyNode; //导入依赖的package包/类
@Override
public void visitIterationStrategyTopNode(IterationStrategyTopNode bean) {
if (checkComplete&&bean.isEmpty())
listener.emptyIterationStrategyTopNode(bean);
Map<Port, IterationStrategyNode> portsSoFar = new HashMap<>();
for (IterationStrategyNode subNode : bean)
if (subNode instanceof PortNode) {
InputProcessorPort port = ((PortNode) subNode).getInputProcessorPort();
if (port != null) {
if (portsSoFar.containsKey(port))
listener.portMentionedTwice(portsSoFar.get(port), subNode);
else
portsSoFar.put(port, subNode);
}
} else
for (Port p : getReferencedPorts((IterationStrategyTopNode) subNode))
if (portsSoFar.containsKey(p))
listener.portMentionedTwice(portsSoFar.get(p), subNode);
else
portsSoFar.put(p, subNode);
}
示例4: simpleDot
import org.apache.taverna.scufl2.api.iterationstrategy.IterationStrategyNode; //导入依赖的package包/类
@Test
public void simpleDot() throws Exception {
assertEquals(1, concat.getIterationStrategyStack().size());
IterationStrategyTopNode top = concat.getIterationStrategyStack().get(0);
assertTrue(top instanceof DotProduct);
assertEquals(2, top.size());
IterationStrategyNode node1 = top.get(0);
assertTrue(node1 instanceof PortNode);
PortNode portNode1 = (PortNode) node1;
assertEquals(0, portNode1.getDesiredDepth().intValue());
assertEquals(concat.getInputPorts().getByName("string1"), portNode1.getInputProcessorPort());
IterationStrategyNode node2 = top.get(1);
assertTrue(node2 instanceof PortNode);
PortNode portNode2 = (PortNode) node2;
assertEquals(0, portNode2.getDesiredDepth().intValue());
assertEquals(concat.getInputPorts().getByName("string2"), portNode2.getInputProcessorPort());
assertEquals(concat.getInputPorts().getByName("string2"), portNode2.getInputProcessorPort());
}
示例5: actionPerformed
import org.apache.taverna.scufl2.api.iterationstrategy.IterationStrategyNode; //导入依赖的package包/类
public void actionPerformed(ActionEvent e) {
IterationStrategyNode nodeToBeRemoved = selectedNode;
//DefaultTreeModel model = tree.getModel();
// Now removeButton the candidate nodes from their parents and
// put them back into the root node
IterationStrategyNode root = findRoot();
if (root == selectedNode) {
return;
}
IterationStrategyNode oldParent = nodeToBeRemoved.getParent();
for (IterationStrategyNode nodeToMove : descendentsOfNode(nodeToBeRemoved)) {
nodeToMove.setParent(oldParent);
}
nodeToBeRemoved.setParent(null);
tree.refreshModel();
// Disable the various buttons, as the current selection
// is now invalid.
remove.setEnabled(false);
addCross.setEnabled(false);
addDot.setEnabled(false);
change.setEnabled(false);
selectNode(oldParent);
}
示例6: findPortNode
import org.apache.taverna.scufl2.api.iterationstrategy.IterationStrategyNode; //导入依赖的package包/类
private PortNode findPortNode(IterationStrategyTopNode topNode,
InputProcessorPort port) {
for (IterationStrategyNode node : topNode) {
if (node instanceof PortNode) {
PortNode portNode = (PortNode) node;
if (port.equals(portNode.getInputProcessorPort()))
return portNode;
} else if (node instanceof IterationStrategyTopNode) {
IterationStrategyTopNode iterationStrategyTopNode = (IterationStrategyTopNode) node;
PortNode result = findPortNode(iterationStrategyTopNode, port);
if (result != null)
return result;
}
}
return null;
}
示例7: fillInDesiredCardinalities
import org.apache.taverna.scufl2.api.iterationstrategy.IterationStrategyNode; //导入依赖的package包/类
private void fillInDesiredCardinalities(
IterationStrategyNode iterationStrategyNode,
Map<InputProcessorPort, Integer> desiredCardinalities) {
if (iterationStrategyNode instanceof IterationStrategyTopNode)
for (IterationStrategyNode subNode : (IterationStrategyTopNode) iterationStrategyNode)
fillInDesiredCardinalities(subNode, desiredCardinalities);
else if (iterationStrategyNode instanceof PortNode) {
PortNode portNode = (PortNode) iterationStrategyNode;
desiredCardinalities.put(portNode.getInputProcessorPort(),
portNode.getDesiredDepth());
}
}
示例8: getDotProductIterationDepth
import org.apache.taverna.scufl2.api.iterationstrategy.IterationStrategyNode; //导入依赖的package包/类
public Integer getDotProductIterationDepth(DotProduct dotProduct,
Map<InputProcessorPort, Integer> inputDepths) {
if (dotProduct.isEmpty()) {
validatorState.get().getEventListener().emptyDotProduct(dotProduct);
// validatorState.get().addEmptyDotProduct(dotProduct);
validatorState.get().getEventListener()
.failedProcessorAdded(validatorState.get().getProcessor());
// validatorState.get().failCurrentProcessor();
return null;
}
Integer depth = getIterationDepth(dotProduct.get(0), inputDepths);
if (depth == null)
return null;
for (IterationStrategyNode childNode : dotProduct) {
Integer childNodeDepth = getIterationDepth(childNode, inputDepths);
if (childNodeDepth == null)
return null;
if (!childNodeDepth.equals(depth)) {
validatorState.get().getEventListener()
.dotProductIterationMismatch(dotProduct);
// validatorState.get().addDotProductIterationMismatch(dotProduct);
validatorState
.get()
.getEventListener()
.failedProcessorAdded(
validatorState.get().getProcessor());
// validatorState.get().failCurrentProcessor();
return null;
}
}
return depth;
}
示例9: getReferencedPorts
import org.apache.taverna.scufl2.api.iterationstrategy.IterationStrategyNode; //导入依赖的package包/类
private Set<Port> getReferencedPorts(IterationStrategyTopNode bean) {
Set<Port> result = new HashSet<>();
for (IterationStrategyNode subNode : bean)
if (subNode instanceof PortNode) {
InputProcessorPort port = ((PortNode) subNode).getInputProcessorPort();
if (port != null)
result.add(port);
} else
result.addAll(getReferencedPorts((IterationStrategyTopNode) subNode));
return result;
}
示例10: parseIterationStrategyNode
import org.apache.taverna.scufl2.api.iterationstrategy.IterationStrategyNode; //导入依赖的package包/类
protected IterationStrategyNode parseIterationStrategyNode(
IterationNode topNode) throws ReaderException {
if (topNode instanceof PortProduct) {
PortProduct portProduct = (PortProduct) topNode;
PortNode portNode = new PortNode();
portNode.setDesiredDepth(portProduct.getDepth().intValue());
String name = portProduct.getName();
Processor processor = parserState.get().getCurrentProcessor();
InputProcessorPort inputProcessorPort = processor.getInputPorts()
.getByName(name);
portNode.setInputProcessorPort(inputProcessorPort);
return portNode;
}
IterationStrategyNode node;
if (topNode instanceof DotProduct)
node = new org.apache.taverna.scufl2.api.iterationstrategy.DotProduct();
else if (topNode instanceof CrossProduct)
node = new org.apache.taverna.scufl2.api.iterationstrategy.CrossProduct();
else
throw new ReaderException("Invalid node " + topNode);
@SuppressWarnings("unchecked")
List<IterationStrategyNode> children = (List<IterationStrategyNode>) node;
IterationNodeParent parent = (IterationNodeParent) topNode;
for (IterationNode child : parent.getCrossOrDotOrPort())
children.add(parseIterationStrategyNode(child));
return node;
}
示例11: simpleCrossProduct
import org.apache.taverna.scufl2.api.iterationstrategy.IterationStrategyNode; //导入依赖的package包/类
@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());
}
示例12: crossAndDot
import org.apache.taverna.scufl2.api.iterationstrategy.IterationStrategyNode; //导入依赖的package包/类
@Test
public void crossAndDot() throws Exception {
assertEquals(1, shape.getIterationStrategyStack().size());
IterationStrategyTopNode top = shape.getIterationStrategyStack().get(0);
assertTrue(top instanceof CrossProduct);
assertEquals(2, top.size());
IterationStrategyNode node1 = top.get(0);
assertTrue(node1 instanceof PortNode);
PortNode portNode1 = (PortNode) node1;
assertEquals(0, portNode1.getDesiredDepth().intValue());
assertEquals(shape.getInputPorts().getByName("string1"), portNode1.getInputProcessorPort());
IterationStrategyNode node2 = top.get(1);
assertTrue(node2 instanceof DotProduct);
DotProduct portNode2 = (DotProduct) node2;
// Note: string3 before string2
IterationStrategyNode node21 = portNode2.get(0);
assertTrue(node21 instanceof PortNode);
PortNode portNode21 = (PortNode) node21;
assertEquals(0, portNode21.getDesiredDepth().intValue());
assertEquals(shape.getInputPorts().getByName("string3"), portNode21.getInputProcessorPort());
IterationStrategyNode node22 = portNode2.get(1);
assertTrue(node22 instanceof PortNode);
PortNode portNode22 = (PortNode) node22;
assertEquals(0, portNode22.getDesiredDepth().intValue());
assertEquals(shape.getInputPorts().getByName("string2"), portNode22.getInputProcessorPort());
}
示例13: getChild
import org.apache.taverna.scufl2.api.iterationstrategy.IterationStrategyNode; //导入依赖的package包/类
@Override
public IterationStrategyNode getChild(Object parent, int index) {
if (!(parent instanceof IterationStrategyTopNode)) {
return null;
}
try {
return ((IterationStrategyTopNode)parent).get(index);
} catch (IndexOutOfBoundsException ex) {
return null;
}
}
示例14: getChildAt
import org.apache.taverna.scufl2.api.iterationstrategy.IterationStrategyNode; //导入依赖的package包/类
@Override
public IterationStrategyTreeNode getChildAt(int childIndex) {
if (node instanceof IterationStrategyTopNode) {
IterationStrategyNode child = ((IterationStrategyTopNode) node).get(childIndex);
return new IterationStrategyTreeNode(child);
}
throw new IndexOutOfBoundsException("This node has no children: " + node);
}
示例15: getIndex
import org.apache.taverna.scufl2.api.iterationstrategy.IterationStrategyNode; //导入依赖的package包/类
@Override
public int getIndex(TreeNode child) {
if (node instanceof IterationStrategyTopNode) {
IterationStrategyNode childNode = ((IterationStrategyTreeNode)child).node;
return ((IterationStrategyTopNode) node).indexOf(childNode);
}
return -1;
}