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

📄 immutableexport.java

📁 The ElectricTM VLSI Design System is an open-source Electronic Design Automation (EDA) system that c
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
/* -*- tab-width: 4 -*- * * Electric(tm) VLSI Design System * * File: ImmutableExport.java * Written by: Dmitry Nadezhin, Sun Microsystems. * * Copyright (c) 2005 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.database;import com.sun.electric.database.id.IdReader;import com.sun.electric.database.id.ExportId;import com.sun.electric.database.id.IdWriter;import com.sun.electric.database.id.PortProtoId;import com.sun.electric.database.prototype.PortCharacteristic;import com.sun.electric.database.text.ImmutableArrayList;import com.sun.electric.database.text.Name;import com.sun.electric.database.variable.TextDescriptor;import com.sun.electric.database.variable.Variable;import java.io.IOException;/** * Immutable class ImmutableExport represents an export. */public class ImmutableExport extends ImmutableElectricObject {    public final static ImmutableExport[] NULL_ARRAY = {};    public final static ImmutableArrayList<ImmutableExport> EMPTY_LIST = new ImmutableArrayList<ImmutableExport>(NULL_ARRAY);	/** set if this port should always be drawn */			private static final int PORTDRAWN =         0400000000;	/** set to exclude this port from the icon */			private static final int BODYONLY =         01000000000;//	/** input/output/power/ground/clock state */			private static final int STATEBITS =       036000000000;	/** input/output/power/ground/clock state */			private static final int STATEBITSSHIFTED =         036;	/** input/output/power/ground/clock state */			private static final int STATEBITSSH =               27;    /** id of this Export. */                                       public final ExportId exportId;	/** name of this ImmutableExport. */							public final Name name;	/** The text descriptor of name of ImmutableExport. */          public final TextDescriptor nameDescriptor;    /** The nodeId of original PortInst. */                         public final int originalNodeId;    /** The PortProtoId of orignal PortInst. */                     public final PortProtoId originalPortId;    /** True if this ImmutableExport to be always drawn. */         public final boolean alwaysDrawn;    /** True to exclude this ImmutableExport from the icon. */      public final boolean bodyOnly;	/** PortCharacteristic of this ImmutableExport. */              public final PortCharacteristic characteristic;	/**	 * The private constructor of ImmutableExport. Use the factory "newInstance" instead.     * @param exportId id of new Export.	 * @param name name of new ImmutableExport.     * @param nameDescriptor TextDescriptor of name of this ImmutableExport.     * @param originalNodeId node id of original PortInst.     * @param originalPortId port proto id of original PortInst.     * @param alwaysDrawn true if new ImmutableExport is always drawn.     * @param bodyOnly true to exclude new ImmutableExport from the icon.     * @param characteristic PortCharacteristic of new ImmutableExport.     * @param vars array of Variables of this ImmutableNodeInst	 */     ImmutableExport(ExportId exportId, Name name, TextDescriptor nameDescriptor,             int originalNodeId, PortProtoId originalPortId,             boolean alwaysDrawn, boolean bodyOnly, PortCharacteristic characteristic, Variable[] vars) {        super(vars, 0);        this.exportId = exportId;        this.name = name;        this.nameDescriptor = nameDescriptor;        this.originalNodeId = originalNodeId;        this.originalPortId = originalPortId;        this.alwaysDrawn = alwaysDrawn;        this.bodyOnly = bodyOnly;        this.characteristic = characteristic;//        check();    }	/**	 * Returns new ImmutableExport object.     * @param exportId id of new Export.	 * @param name name of new ImmutableExport.     * @param nameDescriptor TextDescriptor of name of this ImmutableExport.     * @param originalNodeId node id of original PortInst.     * @param originalPortId port proto id of original PortInst.     * @param alwaysDrawn true if new ImmutableExport is always drawn.     * @param bodyOnly true to exclude new ImmutableExport from the icon.     * @param characteristic PortCharacteristic of new ImmutableExport.	 * @return new ImmutableExport object.	 * @throws NullPointerException if exportId, name, originalPortId is null.     * @throws IllegalArgumentException if originalNodeId is bad.	 */    public static ImmutableExport newInstance(ExportId exportId, Name name, TextDescriptor nameDescriptor,             int originalNodeId, PortProtoId originalPortId,             boolean alwaysDrawn, boolean bodyOnly, PortCharacteristic characteristic) {		if (exportId == null) throw new NullPointerException("exportId");		if (name == null) throw new NullPointerException("name");        if (!name.isValid() || name.hasEmptySubnames() || name.isTempname()) throw new IllegalArgumentException("name");        if (nameDescriptor != null)            nameDescriptor = nameDescriptor.withDisplayWithoutParam();        if (originalNodeId < 0) throw new IllegalArgumentException("originalNodeId");        if (originalPortId == null) throw new NullPointerException("orignalPortId");        if (characteristic == null) characteristic = PortCharacteristic.UNKNOWN;		return new ImmutableExport(exportId, name, nameDescriptor,                originalNodeId, originalPortId, alwaysDrawn, bodyOnly, characteristic, Variable.NULL_ARRAY);    }	/**	 * Returns ImmutableExport which differs from this ImmutableExport by name.	 * @param name export name key.	 * @return ImmutableExport which differs from this ImmutableExport by name.	 * @throws NullPointerException if name is null	 */	public ImmutableExport withName(Name name) {		if (this.name.toString().equals(name.toString())) return this;		if (name == null) throw new NullPointerException("name");        if (!name.isValid() || name.hasEmptySubnames() || name.isTempname()) throw new IllegalArgumentException("name");		return new ImmutableExport(this.exportId, name, this.nameDescriptor,                this.originalNodeId, this.originalPortId, this.alwaysDrawn, this.bodyOnly, this.characteristic, getVars());	}	/**	 * Returns ImmutableExport which differs from this ImmutableExport by name descriptor.     * @param nameDescriptor TextDescriptor of name	 * @return ImmutableExport which differs from this ImmutableExport by name descriptor.	 */	public ImmutableExport withNameDescriptor(TextDescriptor nameDescriptor) {        if (nameDescriptor != null)            nameDescriptor = nameDescriptor.withDisplayWithoutParam();        if (this.nameDescriptor == nameDescriptor) return this;		return new ImmutableExport(this.exportId, this.name, nameDescriptor,                this.originalNodeId, this.originalPortId, this.alwaysDrawn, this.bodyOnly, this.characteristic, getVars());	}	/**	 * Returns ImmutableExport which differs from this ImmutableExport by original port.     * @param originalNodeId node id of original PortInst.     * @param originalPortId port proto id of original PortInst.	 * @return ImmutableExport which differs from this ImmutableExport by original port.     * @throws NullPointerException if originalPortId is null.	 */	public ImmutableExport withOriginalPort(int originalNodeId, PortProtoId originalPortId) {        if (this.originalNodeId == originalNodeId && this.originalPortId == originalPortId) return this;        if (originalPortId == null) throw new NullPointerException("originalPortId");		return new ImmutableExport(this.exportId, this.name, this.nameDescriptor,                originalNodeId, originalPortId, this.alwaysDrawn, this.bodyOnly, this.characteristic, getVars());	}	/**	 * Returns ImmutableExport which differs from this ImmutableExport by alwaysDrawn flag.     * @param alwaysDrawn true if new ImmutableExport is always drawn.	 * @return ImmutableExport which differs from this ImmutableExport by alwaysDrawn flag.	 */	public ImmutableExport withAlwaysDrawn(boolean alwaysDrawn) {        if (this.alwaysDrawn == alwaysDrawn) return this;		return new ImmutableExport(this.exportId, this.name, this.nameDescriptor,                this.originalNodeId, this.originalPortId, alwaysDrawn, this.bodyOnly, this.characteristic, getVars());	}	/**	 * Returns ImmutableExport which differs from this ImmutableExport by bodyOnly flag.     * @param bodyOnly true to exclude new ImmutableExport from the icon.	 * @return ImmutableExport which differs from this ImmutableExport by bodyOnly flag.	 */	public ImmutableExport withBodyOnly(boolean bodyOnly) {        if (this.bodyOnly == bodyOnly) return this;		return new ImmutableExport(this.exportId, this.name, this.nameDescriptor,                this.originalNodeId, this.originalPortId, this.alwaysDrawn, bodyOnly, this.characteristic, getVars());	}

⌨️ 快捷键说明

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