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

📄 immutablearcinst.java

📁 The ElectricTM VLSI Design System is an open-source Electronic Design Automation (EDA) system that c
💻 JAVA
📖 第 1 页 / 共 4 页
字号:
    /**     * Return a hash code value for fields of this object.     * Variables of objects are not compared     */    public int hashCodeExceptVariables() { return arcId; }    /**     * Indicates whether fields of other ImmutableElectricObject are equal to fileds of this object.     * Variables of objects are not compared.     * @param o other ImmutableElectricObject.     * @return true if fields of objects are equal.     */    public boolean equalsExceptVariables(ImmutableElectricObject o) {        if (this == o) return true;        if (!(o instanceof ImmutableArcInst)) return false;        ImmutableArcInst that = (ImmutableArcInst)o;        return this.arcId == that.arcId && this.protoId == that.protoId &&                this.name == that.name && this.nameDescriptor == that.nameDescriptor &&                this.tailNodeId == that.tailNodeId && this.tailPortId == that.tailPortId && this.tailLocation == that.tailLocation &&                this.headNodeId == that.headNodeId && this.headPortId == that.headPortId && this.headLocation == that.headLocation &&                this.gridExtendOverMin == that.gridExtendOverMin && this.angle == that.angle && this.flags == that.flags;    }	/**	 * Method to fill in an AbstractShapeBuilder a polygon that describes this ImmutableArcInst in grid units.	 * The polygon is described by its width, and style.	 */    public void makeGridBoxInt(int[] intCoords, boolean tailExtended, boolean headExtended, int gridExtend) {        // make the box        int w2 = gridExtend;        assert w2 > 0;        int et = tailExtended ? w2 : 0;        int eh = headExtended ? w2 : 0;        int x, y;        assert intCoords.length == 4;        switch (angle) {            case 0:                y = (int)tailLocation.getGridY();                intCoords[0] = (int)tailLocation.getGridX() - et;                intCoords[1] = y - w2;                intCoords[2] = (int)headLocation.getGridX() + eh;                intCoords[3] = y + w2;                break;            case 900:                x = (int)tailLocation.getGridX();                intCoords[0] = x - w2;                intCoords[1] = (int)tailLocation.getGridY() - et;                intCoords[2] = x + w2;                intCoords[3] = (int)headLocation.getGridY() + eh;                break;            case 1800:                y = (int)tailLocation.getGridY();                intCoords[0] = (int)headLocation.getGridX() - eh;                intCoords[1] = y - w2;                intCoords[2] = (int)tailLocation.getGridX() + et;                intCoords[3] = y + w2;                break;            case 2700:                x = (int)tailLocation.getGridX();                intCoords[0] = x - w2;                intCoords[1] = (int)headLocation.getGridY() - eh;                intCoords[2] = x + w2;                intCoords[3] = (int)tailLocation.getGridY() + et;                break;            default:                throw new AssertionError();        }    }	/**	 * Method to get the curvature radius on this ImmutableArcInst.	 * The curvature (used in artwork and round-cmos technologies) lets an arc	 * curve.	 * @return the curvature radius on this ImmutableArcInst.	 * Returns null if there is no curvature information.	 */    public Double getRadius() {        Variable var = getVar(ARC_RADIUS);        if (var == null) return null;        // get the radius of the circle, check for validity        Object obj = var.getObject();        if (obj instanceof Double)            return (Double)obj;        if (obj instanceof Integer)            return new Double(((Integer)obj).intValue() / 2000.0);        return null;	}    public boolean check(TechPool techPool) {        ArcProto protoType = techPool.getArcProto(protoId);        if (protoType == null) return false;        if (isTailNegated()) {            if (!techPool.getPrimitivePort((PrimitivePortId)tailPortId).isNegatable()) return false;            if (protoType.getTechnology().isNoNegatedArcs()) return false;        }        if (isHeadNegated()) {            if (!techPool.getPrimitivePort((PrimitivePortId)headPortId).isNegatable()) return false;            if (protoType.getTechnology().isNoNegatedArcs()) return false;        }        return true;    }	/**	 * Checks invariant of this ImmutableArcInst.	 * @throws AssertionError if invariant is broken.	 */	public void check() {        super.check(false);        assert arcId >= 0;		assert protoId != null;		assert name != null;        assert name.isValid() && !name.hasEmptySubnames();        if (name.isTempname())            assert name.getBasename() == BASENAME && !name.isBus();        if (nameDescriptor != null)            assert nameDescriptor.isDisplay() && !nameDescriptor.isParam();        assert tailNodeId >= 0;        assert tailPortId != null;        assert tailLocation != null;        assert headNodeId >= 0;        assert headPortId != null;        assert headLocation != null;        assert -MAX_EXTEND < gridExtendOverMin && gridExtendOverMin < MAX_EXTEND;        assert (flags & ~(DATABASE_FLAGS|MANHATTAN_MASK)) == 0;        assert isManhattan() == isManhattan(headLocation, tailLocation, angle);        if (isTailNegated())            assert tailPortId instanceof PrimitivePortId;        if (isHeadNegated())            assert headPortId instanceof PrimitivePortId;        assert 0 <= angle && angle < 3600;        if (!tailLocation.equals(headLocation))            assert angle == GenMath.figureAngle(headLocation.getGridX() - tailLocation.getGridX(), headLocation.getGridY() - tailLocation.getGridY());	}	/**	 * Method to compute the "userbits" to use for a given ArcInst.	 * The "userbits" are a set of bits that describes constraints and other properties,	 * and are stored in ELIB files.	 * The negation, directionality, and end-extension must be converted.	 * @return the "userbits" for that ArcInst.	 */	public int getElibBits()	{		int elibBits = 0;        if (isRigid()) elibBits |= ELIB_FIXED;        if (isFixedAngle()) elibBits |= ELIB_FIXANG;        if (!isSlidable()) elibBits |= ELIB_CANTSLIDE;        if (isHardSelect()) elibBits |= ELIB_HARDSELECTA;		// adjust bits for extension		if (!isHeadExtended() || !isTailExtended())		{			elibBits |= ELIB_NOEXTEND;			if (isHeadExtended() != isTailExtended())			{				if (isTailExtended()) elibBits |= ELIB_NOTEND0;				if (isHeadExtended()) elibBits |= ELIB_NOTEND1;			}		}		// adjust bits for directionality		if (isHeadArrowed() || isTailArrowed() || isBodyArrowed())		{			elibBits |= ELIB_ISDIRECTIONAL;			if (isTailArrowed()) elibBits |= ELIB_REVERSEEND;			if (!isHeadArrowed() && !isTailArrowed()) elibBits |= ELIB_NOTEND1;		}		// adjust bits for negation        boolean normalEnd = (elibBits & ELIB_REVERSEEND) == 0;		if (isTailNegated()) elibBits |= (normalEnd ? ELIB_ISTAILNEGATED : ELIB_ISHEADNEGATED);		if (isHeadNegated()) elibBits |= (normalEnd ? ELIB_ISHEADNEGATED : ELIB_ISTAILNEGATED);		int elibAngle = (angle + 5)/10;		if (elibAngle >= 360) elibAngle -= 360;        return elibBits | (elibAngle << ELIB_AANGLESH);	}	/**	 * Method to convert ELIB userbits to database flags.	 * The flags are a set of bits that describes constraints and other properties.	 * and are stored in ELIB files.	 * The negation, directionality, and end-extension must be converted.	 * @param elibBits the disk userbits.     * @return the database flags	 */	public static int flagsFromElib(int elibBits)	{        int newBits = 0;        if ((elibBits & ELIB_FIXED) != 0) newBits |= RIGID.mask;        if ((elibBits & ELIB_FIXANG) != 0) newBits |= FIXED_ANGLE.mask;        if ((elibBits & ELIB_CANTSLIDE) == 0) newBits |= SLIDABLE.mask;        if ((elibBits & ELIB_HARDSELECTA) != 0) newBits |= HARD_SELECT.mask;		if ((elibBits&ELIB_ISTAILNEGATED) != 0)		{			newBits |= (elibBits&ELIB_REVERSEEND) == 0 ? TAIL_NEGATED.mask : HEAD_NEGATED.mask;		}		if ((elibBits&ELIB_ISHEADNEGATED) != 0)		{            newBits |= (elibBits&ELIB_REVERSEEND) == 0 ? HEAD_NEGATED.mask : TAIL_NEGATED.mask;		}		if ((elibBits&ELIB_NOEXTEND) != 0)		{			if ((elibBits&ELIB_NOTEND0) != 0) newBits |= TAIL_EXTENDED.mask;			if ((elibBits&ELIB_NOTEND1) != 0) newBits |= HEAD_EXTENDED.mask;		} else {            newBits |= (TAIL_EXTENDED.mask | HEAD_EXTENDED.mask);        }		if ((elibBits&ELIB_ISDIRECTIONAL) != 0)		{            newBits |= BODY_ARROWED.mask;			if ((elibBits&ELIB_REVERSEEND) == 0)			{				if ((elibBits&ELIB_NOTEND1) == 0) newBits |= HEAD_ARROWED.mask;			} else			{				if ((elibBits&ELIB_NOTEND0) == 0) newBits |= TAIL_ARROWED.mask;			}		}        return newBits;	}    /**     * Get angle from ELIB user bits.     * @param elibBits ELIB user bits.     * @return tech specific bits.     */	public static int angleFromElib(int elibBits)	{        int angle = (elibBits & ELIB_AANGLE) >> ELIB_AANGLESH;        return (angle % 360)*10;	}}

⌨️ 快捷键说明

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