📄 xml.java
字号:
* * <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("startDocument"); } } /** * 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("endDocument"); } } /** * 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. * @exception org.xml.sax.SAXException Any SAX exception, possibly * wrapping another exception. * @see org.xml.sax.ContentHandler#endPrefixMapping */ public void endPrefixMapping(String prefix) throws SAXException { if (DEBUG) { System.out.println("endPrefixMapping prefix=" + prefix); } } /** * Receive notification of the start of an element. * * <p>By default, do nothing. Application writers may override this * method in a subclass to take specific actions at the start of * each element (such as allocating a new tree node or writing * output to a file).</p> * * @param uri The Namespace URI, or the empty string if the * element has no Namespace URI or if Namespace * processing is not being performed. * @param localName The local name (without prefix), or the * empty string if Namespace processing is not being * performed. * @param qName The qualified name (with prefix), or the * empty string if qualified names are not available. * @param attributes The attributes attached to the element. If * there are no attributes, it shall be an empty * Attributes object. * @exception org.xml.sax.SAXException Any SAX exception, possibly * wrapping another exception. * @see org.xml.sax.ContentHandler#startElement */ public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException { boolean dump = false; XmlKeyword key = xmlKeywords.get(localName);// System.out.print("<" + key.name()); this.attributes = attributes; switch (key) { case technology: tech.techName = a("name"); tech.className = a_("class");// dump = true; break; case version: Version version = new Version(); version.techVersion = Integer.parseInt(a("tech")); version.electricVersion = com.sun.electric.database.text.Version.parseVersion(a("electric")); tech.versions.add(version); break; case numMetals: tech.minNumMetals = Integer.parseInt(a("min")); tech.maxNumMetals = Integer.parseInt(a("max")); tech.defaultNumMetals = Integer.parseInt(a("default")); break; case scale: tech.scaleValue = Double.parseDouble(a("value")); tech.scaleRelevant = Boolean.parseBoolean(a("relevant")); break; case defaultFoundry: tech.defaultFoundry = a("value"); break; case minResistance: tech.minResistance = Double.parseDouble(a("value")); break; case minCapacitance: tech.minCapacitance = Double.parseDouble(a("value")); break; case transparentLayer: curTransparent = Integer.parseInt(a("transparent")); curR = curG = curB = 0; break; case layer: curLayer = new Layer(); curLayer.name = a("name"); curLayer.function = com.sun.electric.technology.Layer.Function.valueOf(a("fun")); String extraFunStr = a_("extraFun"); if (extraFunStr != null) { if (extraFunStr.equals("depletion_heavy")) curLayer.extraFunction = com.sun.electric.technology.Layer.Function.DEPLETION|com.sun.electric.technology.Layer.Function.HEAVY; else if (extraFunStr.equals("depletion_light")) curLayer.extraFunction = com.sun.electric.technology.Layer.Function.DEPLETION|com.sun.electric.technology.Layer.Function.LIGHT; else if (extraFunStr.equals("enhancement_heavy")) curLayer.extraFunction = com.sun.electric.technology.Layer.Function.ENHANCEMENT|com.sun.electric.technology.Layer.Function.HEAVY; else if (extraFunStr.equals("enhancement_light")) curLayer.extraFunction = com.sun.electric.technology.Layer.Function.ENHANCEMENT|com.sun.electric.technology.Layer.Function.LIGHT; else curLayer.extraFunction = com.sun.electric.technology.Layer.Function.parseExtraName(extraFunStr); } curTransparent = 0; curR = curG = curB = 0; patternedOnDisplay = false; patternedOnPrinter = false; Arrays.fill(pattern, 0); curPatternIndex = 0;// EGraphics.Outline outline = null; break; case transparentColor: curTransparent = Integer.parseInt(a("transparent")); if (curTransparent > 0) { Color color = tech.transparentLayers.get(curTransparent - 1); curR = color.getRed(); curG = color.getGreen(); curB = color.getBlue(); } break; case opaqueColor: curR = Integer.parseInt(a("r")); curG = Integer.parseInt(a("g")); curB = Integer.parseInt(a("b")); break; case display3D: curLayer.thick3D = Double.parseDouble(a("thick")); curLayer.height3D = Double.parseDouble(a("height")); curLayer.mode3D = a_("mode"); String factor3DStr = a_("factor"); curLayer.factor3D = factor3DStr != null ? Double.parseDouble(factor3DStr) : 0; break; case cifLayer: curLayer.cif = a("cif"); break; case skillLayer: curLayer.skill = a("skill"); break; case parasitics: curLayer.resistance = Double.parseDouble(a("resistance")); curLayer.capacitance = Double.parseDouble(a("capacitance")); curLayer.edgeCapacitance = Double.parseDouble(a("edgeCapacitance")); break; case pureLayerNode: curLayer.pureLayerNode = new PureLayerNode(); curLayer.pureLayerNode.name = a("name"); String styleStr = a_("style"); curLayer.pureLayerNode.style = styleStr != null ? Poly.Type.valueOf(styleStr) : Poly.Type.FILLED; curLayer.pureLayerNode.port = a("port"); curDistance = curLayer.pureLayerNode.size; break; case arcProto: curArc = new ArcProto(); curArc.name = a("name"); curArc.function = com.sun.electric.technology.ArcProto.Function.valueOf(a("fun")); break; case wipable: curArc.wipable = true; break; case curvable: curArc.curvable = true; break; case special: curArc.special = true; break; case notUsed: if (curArc != null) curArc.notUsed = true; if (curNode != null) curNode.notUsed = true; break; case skipSizeInPalette: if (curArc != null) curArc.skipSizeInPalette = true; if (curNode != null) curNode.skipSizeInPalette = true; break; case diskOffset: if (curArc != null) curArc.diskOffset.put(new Integer(Integer.parseInt(a("untilVersion"))), new Double(Double.parseDouble(a("width")))); if (curNode != null) curNode.diskOffset.put(new Integer(Integer.parseInt(a("untilVersion"))), EPoint.fromLambda(Double.parseDouble(a("x")), Double.parseDouble(a("y")))); break; case defaultWidth: if (curArc != null) curDistance = curArc.defaultWidth; if (curNode != null) curDistance = curNode.defaultWidth; break; case arcLayer: ArcLayer arcLayer = new ArcLayer(); arcLayer.layer = a("layer"); curDistance = arcLayer.extend; arcLayer.style = Poly.Type.valueOf(a("style")); curArc.arcLayers.add(arcLayer); break; case primitiveNode: curNode = new PrimitiveNode(); curNode.name = a("name"); curNode.function = com.sun.electric.technology.PrimitiveNode.Function.valueOf(a("fun")); break; case shrinkArcs: curNode.shrinkArcs = true; break; case square: curNode.square = true; break; case canBeZeroSize: curNode.canBeZeroSize = true; break; case wipes: curNode.wipes = true; break; case lockable: curNode.lockable = true; break; case edgeSelect: curNode.edgeSelect = true; break; case lowVt: curNode.lowVt = true; break; case highVt: curNode.highVt = true; break; case nativeBit: curNode.nativeBit = true; break; case od18: curNode.od18 = true; break; case od25: curNode.od25 = true; break; case od33: curNode.od33 = true; break; case defaultHeight: curDistance = curNode.defaultHeight; break; case sizeOffset:
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -