📄 xmlparam.java
字号:
/* -*- tab-width: 4 -*- * * Electric(tm) VLSI Design System * * File: XmlParam.java * * Copyright (c) 2003 Sun Microsystems and Static Free Software * * Electric(tm) is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * Electric(tm) is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Electric(tm); see the file COPYING. If not, write to * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, Mass 02111-1307, USA. */package com.sun.electric.technology.xml;import com.sun.electric.database.geometry.EGraphics;import com.sun.electric.database.geometry.EPoint;import com.sun.electric.database.geometry.ERectangle;import com.sun.electric.database.geometry.Poly.Type;import com.sun.electric.technology.DRCTemplate;import com.sun.electric.technology.EdgeH;import com.sun.electric.technology.EdgeV;import com.sun.electric.technology.Technology.TechPoint;import com.sun.electric.tool.Job;import java.awt.Color;import java.io.IOException;import java.io.InputStream;import java.io.PrintWriter;import java.io.Serializable;import java.io.StringReader;import java.io.StringWriter;import java.net.URL;import java.net.URLConnection;import java.util.ArrayList;import java.util.Arrays;import java.util.Calendar;import java.util.Collections;import java.util.Date;import java.util.HashMap;import java.util.LinkedHashMap;import java.util.List;import java.util.Map;import javax.xml.XMLConstants;import javax.xml.parsers.SAXParser;import javax.xml.parsers.SAXParserFactory;import javax.xml.validation.Schema;import javax.xml.validation.SchemaFactory;import org.xml.sax.Attributes;import org.xml.sax.InputSource;import org.xml.sax.Locator;import org.xml.sax.SAXException;import org.xml.sax.SAXParseException;import org.xml.sax.helpers.DefaultHandler;/** * */public class XmlParam { public static class Technology implements Serializable { public String techName; public String className; public String shortTechName; public String description; public int minNumMetals; public int maxNumMetals; public int defaultNumMetals; public double scaleValue; public boolean scaleRelevant; public String defaultFoundry; public double minResistance; public double minCapacitance; private final LinkedHashMap<String,Layer> layers = new LinkedHashMap<String,Layer>(); public final List<ArcProto> arcs = new ArrayList<ArcProto>(); public final List<PrimitiveNode> nodes = new ArrayList<PrimitiveNode>(); public final List<SpiceHeader> spiceHeaders = new ArrayList<SpiceHeader>(); public final List<DisplayStyle> displayStyles = new ArrayList<DisplayStyle>(); public MenuPalette menuPalette; public final LinkedHashMap<String,RuleSet> ruleSets = new LinkedHashMap<String,RuleSet>(); public final List<Foundry> foundries = new ArrayList<Foundry>(); public Layer newLayer(String name) { if (name == null) throw new NullPointerException(); if (layers.containsKey(name)) throw new IllegalArgumentException("Duplicate Layer " + name); Layer layer = new Layer(name); layers.put(name, layer); return layer; } public RuleSet newRuleSet(String name) { if (name == null) throw new NullPointerException(); if (ruleSets.containsKey(name)) throw new IllegalArgumentException("Duplicate RuleSet " + name); RuleSet ruleSet = new RuleSet(name); ruleSets.put(name, ruleSet); return ruleSet; } public Layer findLayer(String name) { return layers.get(name); } public ArcProto findArc(String name) { for (ArcProto arc: arcs) { if (arc.name.equals(name)) return arc; } return null; } public PrimitiveNode findNode(String name) { for (PrimitiveNode node: nodes) { if (node.name.equals(name)) return node; } return null; } public void writeXml(String fileName) { try { PrintWriter out = new PrintWriter(fileName); Writer writer = new Writer(out); writer.writeTechnology(this); out.close(); System.out.println("Wrote " + fileName); System.out.println(" (Add this file to the 'Added Technologies' Project Settings to install it in Electric)"); } catch (IOException e) { System.out.println("Error creating " + fileName); } } } public static class Layer implements Serializable { public final String name; public com.sun.electric.technology.Layer.Function function; public int extraFunction; public String cif; public String skill; public double resistance; public double capacitance; public double edgeCapacitance; public PureLayerNode pureLayerNode; private Layer(String name) { this.name = name; } } public static class PureLayerNode implements Serializable { public String name; public String oldName; public Type style; public String port; public final List<String> portArcs = new ArrayList<String>(); } public static class ArcProto implements Serializable { public String name; public String oldName; public com.sun.electric.technology.ArcProto.Function function; public boolean wipable; public boolean curvable; public boolean special; public boolean notUsed; public boolean skipSizeInPalette; public boolean extended; public boolean fixedAngle; public int angleIncrement; public double antennaRatio; public double elibWidthOffset; public final List<ArcLayer> arcLayers = new ArrayList<ArcLayer>(); public ArcPin arcPin; } public static class ArcPin implements Serializable { public String name; public String portName; public double elibSize; public final List<String> portArcs = new ArrayList<String>(); } public static class ArcLayer implements Serializable { public String layer; public final Distance extend = new Distance(); public Type style; } public static class PrimitiveNode implements Serializable { public String name; public String oldName; public boolean shrinkArcs; public boolean square; public boolean canBeZeroSize; public boolean wipes; public boolean lockable; public boolean edgeSelect; public boolean skipSizeInPalette; public boolean notUsed; public boolean lowVt; public boolean highVt; public boolean nativeBit; public boolean od18; public boolean od25; public boolean od33; public com.sun.electric.technology.PrimitiveNode.Function function; public EPoint diskOffset; public final Distance defaultWidth = new Distance(); public final Distance defaultHeight = new Distance(); public ERectangle nodeBase; public final List<NodeLayer> nodeLayers = new ArrayList<NodeLayer>(); public final List<PrimitivePort> ports = new ArrayList<PrimitivePort>(); public int specialType; public double[] specialValues; public NodeSizeRule nodeSizeRule; public String spiceTemplate; } public static class NodeLayer implements Serializable { public String layer; public Type style; public int portNum; public boolean inLayers; public boolean inElectricalLayers; public int representation; public final Distance lx = new Distance(); public final Distance hx = new Distance(); public final Distance ly = new Distance(); public final Distance hy = new Distance(); public final List<TechPoint> techPoints = new ArrayList<TechPoint>(); public double sizex, sizey, sep1d, sep2d; public String sizeRule, sepRule, sepRule2D; public double lWidth, rWidth, tExtent, bExtent; } public static class NodeSizeRule implements Serializable { public double width; public double height; public String rule; } public static class PrimitivePort implements Serializable { public String name; public int portAngle; public int portRange; public int portTopology; public final Distance lx = new Distance(); public final Distance hx = new Distance(); public final Distance ly = new Distance(); public final Distance hy = new Distance(); public final List<String> portArcs = new ArrayList<String>(); } public static class SpiceHeader implements Serializable { public int level; public final List<String> spiceLines = new ArrayList<String>(); } public static class DisplayStyle implements Serializable { public String name; public final List<Color> transparentLayers = new ArrayList<Color>(); private final LinkedHashMap<Layer,LayerDisplayStyle> layerStylesInternal = new LinkedHashMap<Layer,LayerDisplayStyle>(); public final Map<Layer,LayerDisplayStyle> layerStyles = Collections.unmodifiableMap(layerStylesInternal); public LayerDisplayStyle newLayer(Layer layer) { LayerDisplayStyle lds = new LayerDisplayStyle(layer); LayerDisplayStyle old = layerStylesInternal.put(layer, lds); assert old == null; return lds; } } public static class LayerDisplayStyle implements Serializable { public final Layer layer; public EGraphics desc; public String mode3D; public double factor3D; private LayerDisplayStyle(Layer layer) { this.layer = layer; } } public static class MenuPalette implements Serializable { public int numColumns; public List<List<Object>> menuBoxes = new ArrayList<List<Object>>(); public String writeXml() { StringWriter sw = new StringWriter(); PrintWriter out = new PrintWriter(sw); OneLineWriter writer = new OneLineWriter(out); writer.writeMenuPaletteXml(this); out.close(); return sw.getBuffer().toString(); } } public static class MenuNodeInst implements Serializable { public String protoName; public com.sun.electric.technology.PrimitiveNode.Function function; public String text; public double fontSize; public int rotation; } public static class MenuCell implements Serializable { public String cellName;// public String text;// public double fontSize; } public static class Distance implements Serializable { public double k; public double lambdaValue;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -