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

📄 techpool.java

📁 The ElectricTM VLSI Design System is an open-source Electronic Design Automation (EDA) system that c
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
            }            if (!needCorrection) continue;            ImmutableNodeInst[] correctedNodes = new ImmutableNodeInst[cellRevision.nodes.size()];            for (int nodeIndex = 0; nodeIndex < correctedNodes.length; nodeIndex++) {                ImmutableNodeInst n = cellRevision.nodes.get(nodeIndex);                if (n.protoId instanceof PrimitiveNodeId) {                    PrimitiveNodeId pnId = (PrimitiveNodeId)n.protoId;                    SizeCorrector sizeCorrector = sizeCorrectors.get(pnId.techId);                    if (sizeCorrector != null)                        n = n.withSize(sizeCorrector.getSizeToDisk(n));                }                correctedNodes[nodeIndex] = n;            }            ImmutableArcInst[] correctedArcs = new ImmutableArcInst[cellRevision.arcs.size()];            for (int arcIndex = 0; arcIndex < correctedArcs.length; arcIndex++) {                ImmutableArcInst a = cellRevision.arcs.get(arcIndex);                if (a == null) continue;                ArcProtoId apId = a.protoId;                SizeCorrector sizeCorrector = sizeCorrectors.get(apId.techId);                if (sizeCorrector != null)                    a = a.withGridExtendOverMin(sizeCorrector.getExtendToDisk(a));                correctedArcs[arcIndex] = a;            }            cellRevision = cellRevision.with(cellRevision.d, correctedNodes, correctedArcs, null);            cells.set(i, cellRevision);        }    }    /** Returns Artwork technology in this database */    public Artwork getArtwork() {        return artwork;    }    /** Returns Generic technology in this database */    public Generic getGeneric() {        return generic;    }    /** Returns Schematic technology in this database */    public Schematics getSchematics() {        return schematics;    }    /**     * Tests that two TechPools contains the same set of Tehnologies     * @param that second TechPool     * @return true if this and that TechPools are equal     */    public boolean equals(TechPool that) {        if (idManager != that.idManager || techs.length != that.techs.length) {            return false;        }        for (int techIndex = 0; techIndex < techs.length; techIndex++) {            if (techs[techIndex] != that.techs[techIndex]) {                return false;            }        }        return true;    }    // Implementation of Map<TechId,Technology>    @Override    public boolean containsKey(Object key) {        int techIndex = ((TechId) key).techIndex;        if (techIndex >= techs.length) {            return false;        }        Technology tech = techs[techIndex];        return tech != null && tech.getId() == key;    }    @Override    public boolean containsValue(Object value) {        int techIndex = ((Technology) value).getId().techIndex;        return techIndex < techs.length && techs[techIndex] == value;    }    @Override    public Technology get(Object key) {        int techIndex = ((TechId) key).techIndex;        if (techIndex >= techs.length) {            return null;        }        Technology tech = techs[techIndex];        return tech != null && tech.getId() == key ? tech : null;    }    @Override    public Set<Map.Entry<TechId, Technology>> entrySet() {        return entrySet;    }    @Override    public boolean equals(Object o) {        return o instanceof TechPool ? equals((TechPool) o) : super.equals(o);    }    /**     * Writes this TechPool to IdWriter     * @param writer IdWriter     * @throws java.io.IOException     */    public void write(IdWriter writer) throws IOException {        for (Technology tech : values()) {            writer.writeInt(tech.getId().techIndex);        }        writer.writeInt(-1);    }    /**     * Reads TechPool from IdReader     * @param reader IdReader     * @return TechPool read     * @throws java.io.IOException     */    public static TechPool read(IdReader reader) throws IOException {        ArrayList<Technology> technologiesList = new ArrayList<Technology>();        for (;;) {            int techIndex = reader.readInt();            if (techIndex == -1) {                break;            }            TechId techId = reader.idManager.getTechId(techIndex);            assert techId != null;            Technology tech = Technology.findTechnology(techId);            assert tech != null;            technologiesList.add(tech);        }        return new TechPool(technologiesList);    }    /**     * the connecitivity list for universal and invisible pins     */    ArcProto[] getUnivList() {        if (univList == null)            makeUnivList();        return univList;    }    private void makeUnivList() {        // prepare connectivity list for universal and invisible pins        int univListCount = 0;        for (Technology tech : techs) {            if (tech != null) {                univListCount += tech.getNumArcs();            }        }        univList = new ArcProto[univListCount];        univListCount = 0;        for (Technology tech : techs) {            if (tech == null) {                continue;            }            for (Iterator<ArcProto> ait = tech.getArcs(); ait.hasNext();) {                univList[univListCount++] = ait.next();            }        }        assert univListCount == univList.length;    }	/**	 * Checks invariants in this TechPool.     * @exception AssertionError if invariants are not valid	 */    public void check() {        int size = 0;        int arcCount = 0;        for (int techIndex = 0; techIndex < techs.length; techIndex++) {            Technology tech = techs[techIndex];            if (tech == null) continue;            size++;            TechId techId = tech.getId();            assert techId.idManager == idManager;            assert techId.techIndex == techIndex;            assert idManager.getTechId(techIndex) == techId;            assert get(techId) == tech;            assert containsKey(techId);            assert containsValue(tech);            if (univList != null) {                for (Iterator<ArcProto> it = tech.getArcs(); it.hasNext(); ) {                    ArcProto ap = it.next();                    assert univList[arcCount++] == ap;                }            }        }        assert size == size();        assert size == 0 || techs[techs.length - 1] != null;        if (univList != null)            assert arcCount == univList.length;        TechId prevTechId = null;        for (Entry<TechId,Technology> e: entrySet()) {            assert entrySet.contains(e);            TechId techId = e.getKey();            Technology tech = e.getValue();            assert techId == tech.getId();            assert techs[techId.techIndex] == tech;            if (prevTechId != null)                assert TextUtils.STRING_NUMBER_ORDER.compare(prevTechId.techName, techId.techName) < 0;            prevTechId = techId;        }    }    private class EntrySet extends AbstractSet<Map.Entry<TechId, Technology>> {        private final TechEntry[] entries;        EntrySet() {            TreeSet<Technology> sortedTechs = new TreeSet<Technology>();            for (Technology tech : techs) {                if (tech != null)                    sortedTechs.add(tech);            }            entries = new TechEntry[sortedTechs.size()];            int i = 0;            for (Technology tech: sortedTechs) {                TechId techId = tech.getId();                entries[i++] = new TechEntry(techId, tech);            }        }        @Override        public int size() {            return entries.length;        }        @Override        public boolean contains(Object o) {            Entry e = (Entry) o;            Technology tech = (Technology) e.getValue();            return containsValue(tech) && e.getKey().equals(tech.getId());        }        @Override        public Iterator<Entry<TechId, Technology>> iterator() {            return ArrayIterator.<Map.Entry<TechId,Technology>>iterator(entries);        }    }    private static class TechEntry implements Map.Entry<TechId,Technology> {        private final TechId key;        private final Technology value;    	public TechEntry(TechId key, Technology value) {            if (key == null || value == null)                throw new NullPointerException();            this.key   = key;            this.value = value;        }        public TechId getKey() { return key; }    	public Technology getValue() { return value; }        public Technology setValue(Technology value) { throw new UnsupportedOperationException(); }        @Override public int hashCode() { return key.hashCode() ^ value.hashCode(); }        @Override public String toString() { return key + "=" + value; }        @Override        public boolean equals(Object o) {            if (!(o instanceof Map.Entry))                return false;            Map.Entry e = (Map.Entry)o;            return key.equals(e.getKey()) && value.equals(e.getValue());        }    }}

⌨️ 快捷键说明

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