/** * Get the XML element defining the state of this iteration strategy * * @return */ protected Element asXML() { Element strategyElement = new Element("strategy"); if (terminal.getChildCount() > 0) { AbstractIterationStrategyNode node = (AbstractIterationStrategyNode) (terminal .getChildAt(0)); strategyElement.addContent(elementForNode(node)); } return strategyElement; }
/** * Get the XML element defining the state of this iteration strategy * * @return */ protected Element asXML() { Element strategyElement = new Element("strategy", XMLSerializationConstants.T2_WORKFLOW_NAMESPACE); if (terminal.getChildCount() > 0) { AbstractIterationStrategyNode node = (AbstractIterationStrategyNode) (terminal .getChildAt(0)); strategyElement.addContent(elementForNode(node)); } return strategyElement; }
/** * Get the XML element defining the state of this iteration strategy * * @return */ protected Element asXML() { Element strategyElement = new Element("strategy", XMLSerializationConstants.T2_WORKFLOW_NAMESPACE); if (terminal.getChildCount() > 0) { AbstractIterationStrategyNode node = (AbstractIterationStrategyNode) (terminal .getChildAt(0)); strategyElement.addContent(elementForNode(node)); } return strategyElement; }
private static Element elementForNode(AbstractIterationStrategyNode node) { Element nodeElement = null; if (node instanceof DotProduct) { nodeElement = new Element("dot"); } else if (node instanceof CrossProduct) { nodeElement = new Element("cross"); } else if (node instanceof PrefixDotProduct) { nodeElement = new Element("prefix"); } else if (node instanceof NamedInputPortNode) { NamedInputPortNode nipn = (NamedInputPortNode) node; nodeElement = new Element("port"); nodeElement.setAttribute("name", nipn.getPortName()); nodeElement.setAttribute("depth", nipn.getCardinality() + ""); } else { throw new IllegalArgumentException("Unknown node " + node); } Enumeration<?> children = node.children(); while (children.hasMoreElements()) { TreeNode tn = (TreeNode) children.nextElement(); nodeElement .addContent(elementForNode((AbstractIterationStrategyNode) tn)); } return nodeElement; }
private static Element elementForNode(AbstractIterationStrategyNode node) { Element nodeElement = null; if (node instanceof DotProduct) { nodeElement = new Element("dot", XMLSerializationConstants.T2_WORKFLOW_NAMESPACE); } else if (node instanceof CrossProduct) { nodeElement = new Element("cross", XMLSerializationConstants.T2_WORKFLOW_NAMESPACE); } else if (node instanceof PrefixDotProduct) { nodeElement = new Element("prefix", XMLSerializationConstants.T2_WORKFLOW_NAMESPACE); } else if (node instanceof NamedInputPortNode) { NamedInputPortNode nipn = (NamedInputPortNode) node; nodeElement = new Element("port", XMLSerializationConstants.T2_WORKFLOW_NAMESPACE); nodeElement.setAttribute("name", nipn.getPortName()); nodeElement.setAttribute("depth", nipn.getCardinality() + ""); } else { throw new IllegalArgumentException("Unknown node " + node); } Enumeration<?> children = node.children(); while (children.hasMoreElements()) { TreeNode tn = (TreeNode) children.nextElement(); nodeElement .addContent(elementForNode((AbstractIterationStrategyNode) tn)); } return nodeElement; }
private static Element elementForNode(AbstractIterationStrategyNode node) { Element nodeElement = null; if (node instanceof DotProduct) { nodeElement = new Element("dot", XMLSerializationConstants.T2_WORKFLOW_NAMESPACE); } else if (node instanceof CrossProduct) { nodeElement = new Element("cross", XMLSerializationConstants.T2_WORKFLOW_NAMESPACE); } else if (node instanceof PrefixDotProduct) { nodeElement = new Element("prefix", XMLSerializationConstants.T2_WORKFLOW_NAMESPACE); } else if (node instanceof NamedInputPortNode) { NamedInputPortNode nipn = (NamedInputPortNode) node; nodeElement = new Element("port", XMLSerializationConstants.T2_WORKFLOW_NAMESPACE); nodeElement.setAttribute("name", nipn.getPortName()); nodeElement.setAttribute("depth", nipn.getCardinality() + ""); } else { throw new IllegalArgumentException("Unknown node " + node); } Enumeration<?> children = node.children(); while (children.hasMoreElements()) { TreeNode tn = (TreeNode) children.nextElement(); nodeElement .addContent(elementForNode((AbstractIterationStrategyNode) tn)); } return nodeElement; }