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

📄 xml805.java

📁 The ElectricTM VLSI Design System is an open-source Electronic Design Automation (EDA) system that c
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
        primitiveNode,        //oldName(true),        shrinkArcs,        square,        canBeZeroSize,        wipes,        lockable,        edgeSelect,//        skipSizeInPalette,//        notUsed,        lowVt,        highVt,        nativeBit,        od18,        od25,        od33,//        defaultWidth,        defaultHeight,        sizeOffset,        nodeLayer,        box,        multicutbox,        serpbox,        lambdaBox,        points,        techPoint,        primitivePort,        portAngle,        portTopology(true),//        techPoint,        portArc(true),        polygonal,        serpTrans,        specialValue(true),        minSizeRule,        spiceHeader,        spiceLine,        menuPalette,        menuBox,        menuArc(true),        menuNode(true),        menuText(true),        menuNodeInst,        menuNodeText,        lambda(true),        Foundry,        layerGds,        LayerRule,        LayersRule,        NodeLayersRule,        NodeRule;        private final boolean hasText;        private XmlKeyword() {            hasText = false;        };        private XmlKeyword(boolean hasText) {            this.hasText = hasText;        }    };    private static final HashMap<String,XmlKeyword> xmlKeywords = new HashMap<String,XmlKeyword>();    static {        for (XmlKeyword k: XmlKeyword.class.getEnumConstants())            xmlKeywords.put(k.name(), k);    }    public static Technology parseTechnology(URL fileURL) {//        System.out.println("Memory usage " + Main.getMemoryUsage() + " bytes");        SAXParserFactory factory = SAXParserFactory.newInstance();        factory.setNamespaceAware(true);//        factory.setValidating(true);//        System.out.println("Memory usage " + Main.getMemoryUsage() + " bytes");        // create the parser        try {            long startTime = System.currentTimeMillis();            SAXParser parser = factory.newSAXParser();            URLConnection urlCon = fileURL.openConnection();            InputStream inputStream = urlCon.getInputStream();            XMLReader handler = new XMLReader();            parser.parse(inputStream, handler);            if (Job.getDebug())            {                long stopTime = System.currentTimeMillis();            	System.out.println("Loading technology " + fileURL + " ... " + (stopTime - startTime) + " msec");            }            return handler.tech;        } catch (Exception e) {            e.printStackTrace();        }        System.out.println("Error Parsing XML file ...");        return null;    }    private static class XMLReader extends DefaultHandler {        private static boolean DEBUG = false;        private Locator locator;        private Technology tech = new Technology();        private int curTransparent = 0;        private int curR;        private int curG;        private int curB;        private Layer curLayer;        private boolean patternedOnDisplay;        private boolean patternedOnPrinter;        private final int[] pattern = new int[16];        private int curPatternIndex;        private EGraphics.Outline outline;        private double opacity;        private boolean foreground;        private ArcProto curArc;        private PrimitiveNode curNode;        private NodeLayer curNodeLayer;        private PrimitivePort curPort;        private int curSpecialValueIndex;        private ArrayList<Object> curMenuBox;        private MenuNodeInst curMenuNodeInst;        private Distance curDistance;        private SpiceHeader curSpiceHeader;        private Foundry curFoundry;        private boolean acceptCharacters;        private StringBuilder charBuffer = new StringBuilder();        private Attributes attributes;        private void beginCharacters() {            assert !acceptCharacters;            acceptCharacters = true;            assert charBuffer.length() == 0;        }        private String endCharacters() {            assert acceptCharacters;            String s = charBuffer.toString();            charBuffer.setLength(0);            acceptCharacters = false;            return s;        }        ////////////////////////////////////////////////////////////////////        // Default implementation of the EntityResolver interface.        ////////////////////////////////////////////////////////////////////        /**         * Resolve an external entity.         *         * <p>Always return null, so that the parser will use the system         * identifier provided in the XML document.  This method implements         * the SAX default behaviour: application writers can override it         * in a subclass to do special translations such as catalog lookups         * or URI redirection.</p>         *         * @param publicId The public identifier, or null if none is         *                 available.         * @param systemId The system identifier provided in the XML         *                 document.         * @return The new input source, or null to require the         *         default behaviour.         * @exception java.io.IOException If there is an error setting         *            up the new input source.         * @exception org.xml.sax.SAXException Any SAX exception, possibly         *            wrapping another exception.         * @see org.xml.sax.EntityResolver#resolveEntity         */        public InputSource resolveEntity(String publicId, String systemId)        throws IOException, SAXException {            return null;        }        ////////////////////////////////////////////////////////////////////        // Default implementation of DTDHandler interface.        ////////////////////////////////////////////////////////////////////        /**         * Receive notification of a notation declaration.         *         * <p>By default, do nothing.  Application writers may override this         * method in a subclass if they wish to keep track of the notations         * declared in a document.</p>         *         * @param name The notation name.         * @param publicId The notation public identifier, or null if not         *                 available.         * @param systemId The notation system identifier.         * @exception org.xml.sax.SAXException Any SAX exception, possibly         *            wrapping another exception.         * @see org.xml.sax.DTDHandler#notationDecl         */        public void notationDecl(String name, String publicId, String systemId)        throws SAXException {            int x = 0;        }        /**         * Receive notification of an unparsed entity declaration.         *         * <p>By default, do nothing.  Application writers may override this         * method in a subclass to keep track of the unparsed entities         * declared in a document.</p>         *         * @param name The entity name.         * @param publicId The entity public identifier, or null if not         *                 available.         * @param systemId The entity system identifier.         * @param notationName The name of the associated notation.         * @exception org.xml.sax.SAXException Any SAX exception, possibly         *            wrapping another exception.         * @see org.xml.sax.DTDHandler#unparsedEntityDecl         */        public void unparsedEntityDecl(String name, String publicId,                String systemId, String notationName)                throws SAXException {            int x = 0;        }        ////////////////////////////////////////////////////////////////////        // Default implementation of ContentHandler interface.        ////////////////////////////////////////////////////////////////////        /**         * Receive a Locator object for document events.         *         * <p>By default, do nothing.  Application writers may override this         * method in a subclass if they wish to store the locator for use         * with other document events.</p>         *         * @param locator A locator for all SAX document events.         * @see org.xml.sax.ContentHandler#setDocumentLocator         * @see org.xml.sax.Locator         */        public void setDocumentLocator(Locator locator) {            this.locator = locator;        }        private void printLocator() {            System.out.println("publicId=" + locator.getPublicId() + " systemId=" + locator.getSystemId() +                    " line=" + locator.getLineNumber() + " column=" + locator.getColumnNumber());        }        /**         * Receive notification of the beginning of the document.         *         * <p>By default, do nothing.  Application writers may override this         * method in a subclass to take specific actions at the beginning         * of a document (such as allocating the root node of a tree or         * creating an output file).</p>         *         * @exception org.xml.sax.SAXException Any SAX exception, possibly         *            wrapping another exception.         * @see org.xml.sax.ContentHandler#startDocument         */        public void startDocument()        throws SAXException {            if (DEBUG) {                System.out.println("startDocumnet");            }        }        /**         * Receive notification of the end of the document.         *         * <p>By default, do nothing.  Application writers may override this         * method in a subclass to take specific actions at the end         * of a document (such as finalising a tree or closing an output         * file).</p>         *         * @exception org.xml.sax.SAXException Any SAX exception, possibly         *            wrapping another exception.         * @see org.xml.sax.ContentHandler#endDocument         */        public void endDocument()        throws SAXException {            if (DEBUG) {                System.out.println("endDocumnet");            }        }        /**         * Receive notification of the start of a Namespace mapping.         *         * <p>By default, do nothing.  Application writers may override this         * method in a subclass to take specific actions at the start of         * each Namespace prefix scope (such as storing the prefix mapping).</p>         *         * @param prefix The Namespace prefix being declared.         * @param uri The Namespace URI mapped to the prefix.         * @exception org.xml.sax.SAXException Any SAX exception, possibly         *            wrapping another exception.         * @see org.xml.sax.ContentHandler#startPrefixMapping         */        public void startPrefixMapping(String prefix, String uri)        throws SAXException {            if (DEBUG) {                System.out.println("startPrefixMapping prefix=" + prefix + " uri=" + uri);            }        }        /**         * Receive notification of the end of a Namespace mapping.         *         * <p>By default, do nothing.  Application writers may override this         * method in a subclass to take specific actions at the end of         * each prefix mapping.</p>         *         * @param prefix The Namespace prefix being declared.

⌨️ 快捷键说明

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