⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 staxparalleliterateactionfactory.java

📁 Software Testing Automation Framework (STAF)的开发代码
💻 JAVA
字号:
/*****************************************************************************//* Software Testing Automation Framework (STAF)                              *//* (C) Copyright IBM Corp. 2002                                              *//*                                                                           *//* This software is licensed under the Common Public License (CPL) V1.0.     *//*****************************************************************************/package com.ibm.staf.service.stax;import org.w3c.dom.Node;import org.w3c.dom.NamedNodeMap;import org.w3c.dom.NodeList;public class STAXParallelIterateActionFactory implements STAXActionFactory{    private static String fDTDInfo ="\n" +"<!--================= The Parallel Iterate Element ================ -->\n" +"<!--\n" +"     The parallel iterate element iterates through a list of items,\n" +"     performing its contained task while substituting each item in\n" +"     the list.  The iterated tasks are performed in parallel.\n" +"-->\n" +"<!ELEMENT paralleliterate  (%task;)>\n" +"<!-- var      is the name of a variable which will contain the current\n" +"              item in the list or tuple being iterated.\n" +"              It is a literal.\n" +"     in       is the list or tuple to be iterated.  It is evaluated\n" +"              via Python and must evaluate to be a list or tuple.\n" +"     indexvar is the name of a variable which will contain the index of\n" +"              the current item in the list or tuple being iterated.\n" +"              It is a literal.  The value of the first index is 0.\n" +"-->\n" +"<!ATTLIST paralleliterate\n" +"          var        CDATA    #REQUIRED\n" +"          in         CDATA    #REQUIRED\n" +"          indexvar   CDATA    #IMPLIED\n" +">\n";    public String getDTDInfo()    {        return fDTDInfo;    }    public String getDTDTaskName()    {        return "paralleliterate";    }    public STAXAction parseAction(STAX staxService, STAXJob job,                                  org.w3c.dom.Node root) throws STAXException    {        String itemvar  = new String();        String in       = new String();        String indexvar = new String();        STAXAction iterateAction = null;                NamedNodeMap attrs = root.getAttributes();        for (int i = 0; i < attrs.getLength(); ++i)        {            Node thisAttr = attrs.item(i);            String errorInfo = "\n  Element: " + root.getNodeName() +                               "  Attribute: " + thisAttr.getNodeName();            if (thisAttr.getNodeName().equals("var"))            {                itemvar = thisAttr.getNodeValue();            }            else if (thisAttr.getNodeName().equals("in"))            {                in = STAXUtil.parseAndCompileForPython(                    thisAttr.getNodeValue(), errorInfo);            }            else if (thisAttr.getNodeName().equals("indexvar"))            {                indexvar = thisAttr.getNodeValue();            }             else            {                throw new STAXInvalidXMLAttributeException(                    root.getNodeName() + ": " + thisAttr.getNodeName());            }        }        NodeList children = root.getChildNodes();        for (int i = 0; i < children.getLength(); ++i)        {            Node thisChild = children.item(i);            if (thisChild.getNodeType() == Node.COMMENT_NODE)            {                /* Do nothing */            }            else if (thisChild.getNodeType() == Node.ELEMENT_NODE)            {                if (iterateAction != null)                {                    throw new STAXInvalidXMLElementCountException(                              thisChild.getNodeName());                }                STAXActionFactory factory =                     staxService.getActionFactory(thisChild.getNodeName());                if (factory == null)                {                    throw new STAXInvalidXMLElementException(                              thisChild.getNodeName());                }                iterateAction = factory.parseAction(staxService,job,thisChild);            }            else            {                throw new STAXInvalidXMLNodeTypeException(                          Integer.toString(thisChild.getNodeType()));            }        }        return new STAXParallelIterateAction(itemvar,in,indexvar,iterateAction);    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -