📄 xmlparam.java
字号:
return; } assert !key.hasText;// System.out.println(">"); if (dump) { System.out.println("startElement uri=" + uri + " localName=" + localName + " qName=" + qName); for (int i = 0; i < attributes.getLength(); i++) { System.out.println("\tattribute " + i + " uri=" + attributes.getURI(i) + " localName=" + attributes.getLocalName(i) + " QName=" + attributes.getQName(i) + " type=" + attributes.getType(i) + " value=<" + attributes.getValue(i) + ">"); } } } private double da_(String attrName, double defaultValue) { String s = a_(attrName); return s != null ? Double.parseDouble(s) : defaultValue; } private String a(String attrName) { String v = attributes.getValue(attrName);// System.out.print(" " + attrName + "=\"" + v + "\""); return v; } private String a_(String attrName) { String v = attributes.getValue(attrName); if (v == null) return null;// System.out.print(" " + attrName + "=\"" + v + "\""); return v; } /** * Receive notification of the end of an element. * * <p>By default, do nothing. Application writers may override this * method in a subclass to take specific actions at the end of * each element (such as finalising a 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. * @exception org.xml.sax.SAXException Any SAX exception, possibly * wrapping another exception. * @see org.xml.sax.ContentHandler#endElement */ public void endElement(String uri, String localName, String qName) throws SAXException { XmlKeyword key = xmlKeywords.get(localName); if (key.hasText) { String text = endCharacters();// System.out.println(text + "</" + localName + ">"); switch (key) { case shortName: tech.shortTechName = text; break; case description: tech.description = text; break; case oldName: if (curLayer != null) curLayer.pureLayerNode.oldName = text; if (curArc != null) curArc.oldName = text; if (curNode != null) curNode.oldName = text; break; case extended: curArc.extended = Boolean.parseBoolean(text); break; case fixedAngle: curArc.fixedAngle = Boolean.parseBoolean(text); break; case wipable: curArc.wipable = Boolean.parseBoolean(text); break; case angleIncrement: curArc.angleIncrement = Integer.parseInt(text); break; case antennaRatio: curArc.antennaRatio = Double.parseDouble(text); break; case elibWidthOffset: curArc.elibWidthOffset = Double.parseDouble(text); break; case portTopology: curPort.portTopology = Integer.parseInt(text); break; case portArc: if (curLayer != null && curLayer.pureLayerNode != null) curLayer.pureLayerNode.portArcs.add(text); if (curArc != null && curArc.arcPin != null) curArc.arcPin.portArcs.add(text); if (curPort != null) curPort.portArcs.add(text); break; case specialValue: curNode.specialValues[curSpecialValueIndex++] = Double.parseDouble(text); break; case r: curR = Integer.parseInt(text); break; case g: curG = Integer.parseInt(text); break; case b: curB = Integer.parseInt(text); break; case patternedOnDisplay: patternedOnDisplay = Boolean.parseBoolean(text); break; case patternedOnPrinter: patternedOnPrinter = Boolean.parseBoolean(text); break; case pattern: int p = 0; assert text.length() == 16; for (int j = 0; j < text.length(); j++) { if (text.charAt(text.length() - j - 1) != ' ') p |= (1 << j); } pattern[curPatternIndex++] = p; break; case outlined: outline = EGraphics.Outline.valueOf(text); break; case opacity: opacity = Double.parseDouble(text); break; case foreground: foreground = Boolean.parseBoolean(text); break; case menuArc: curMenuBox.add(tech.findArc(text)); break; case menuNode: curMenuBox.add(tech.findNode(text)); break; case menuText: curMenuBox.add(text); break; case lambda: curDistance.addLambda(Double.parseDouble(text)); break; default: assert false; } return; }// System.out.println("</" + localName + ">"); switch (key) { case technology: break; case layer: if (curDisplayStyle != null) { assert curPatternIndex == pattern.length; curLayerDisplayStyle.desc = new EGraphics(patternedOnDisplay, patternedOnPrinter, outline, curTransparent, curR, curG, curB, opacity, foreground, pattern.clone()); curLayerDisplayStyle = null; } else if (curLayerRule != null) { curDistance = null; } else { curLayer = null; } break; case arcProto: tech.arcs.add(curArc); curArc = null; break; case primitiveNode: tech.nodes.add(curNode); curNode = null; break; case nodeLayer: curNode.nodeLayers.add(curNodeLayer); curNodeLayer = null; break; case primitivePort: curNode.ports.add(curPort); curPort = null; break; case menuNodeInst: curMenuBox.add(curMenuNodeInst); curMenuNodeInst = null; break; case displayStyle: curDisplayStyle = null; break; case transparentLayer: while (curTransparent > curDisplayStyle.transparentLayers.size()) curDisplayStyle.transparentLayers.add(null); Color oldColor = curDisplayStyle.transparentLayers.set(curTransparent - 1, new Color(curR, curG, curB)); assert oldColor == null; break; case menuCell: curMenuBox.add("LOADCELL " + curMenuCell.cellName);// curMenuBox.add(curMenuCell); curMenuCell = null; break; case ruleSet: curRuleSet = null; break; case layerRule: curLayerRule = null; break; case numMetals: case scale: case defaultFoundry: case minResistance: case minCapacitance: case cifLayer: case skillLayer: case parasitics: case pureLayerNode: case wipable: case curvable: case special: case notUsed: case skipSizeInPalette: case arcLayer: case arcPin: case shrinkArcs: case square: case canBeZeroSize: case wipes: case lockable: case edgeSelect: case lowVt: case highVt: case nativeBit: case od18: case od25: case od33: case diskOffset: case defaultWidth: case defaultHeight: case nodeBase: case box: case points: case multicutbox: case serpbox: case lambdaBox: case techPoint: case portAngle: case polygonal: case serpTrans: case minSizeRule: case spiceHeader: case spiceLine: case spiceTemplate: case transparentColor: case opaqueColor: case display3D: case menuPalette: case menuBox: case menuNodeText: case rule: case Foundry: case layerGds: case LayerRule: case LayersRule: case NodeLayersRule: case NodeRule: break; default: assert false; } } /** * Receive notification of character data inside an element. * * <p>By default, do nothing. Application writers may override this * method to take specific actions for each chunk of character data * (such as adding the data to a node or buffer, or printing it to * a file).</p> * * @param ch The characters. * @param start The start position in the character array. * @param length The number of characters to use from the * character array. * @exception org.xml.sax.SAXException Any SAX exception, possibly * wrapping another exception. * @see org.xml.sax.ContentHandler#characters */ public void characters(char ch[], int start, int length) throws SAXException { if (acceptCharacters) { charBuffer.append(ch, start, length); } else { boolean nonBlank = false; for (int i = 0; i < length; i++) { char c = ch[start + i]; nonBlank = nonBlank || c != ' ' && c != '\n'; } if (nonBlank) { System.out.print("characters size=" + ch.length + " start=" + start + " length=" + length + " {"); for (int i = 0; i < length; i++) System.out.print(ch[start + i]); System.out.println("}"); } } } /** * Receive notification of ignorable whitespace in element content. * * <p>By default, do nothing. Application writers may override this * method to take specifi
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -