📄 arcproto.java
字号:
Pref pref = defaultExtendPrefs.get(this); if (pref == null) { pref = Pref.makeDoublePref("DefaultExtendFor" + getName() + "IN" + tech.getTechName(), tech.getTechnologyPreferences(), factory); defaultExtendPrefs.put(this, pref); } return pref; } /** * Method to set the base default width of this ArcProto in lambda units. * This is the reported/selected width, which means that it does not include the width offset. * For example, diffusion arcs are always accompanied by a surrounding well and select. * @param lambdaWidth the full default width of this ArcProto in lambda units. */ public void setDefaultLambdaBaseWidth(double lambdaWidth) { long gridExtendOverMin = DBMath.lambdaToGrid(0.5*lambdaWidth) - gridBaseExtend; if (gridExtendOverMin <= -Integer.MAX_VALUE/8 || gridExtendOverMin >= Integer.MAX_VALUE/8) { System.out.println("ArcProto " + tech.getTechName() + ":" + getName() + " has invalid default base width " + lambdaWidth); return; } getArcProtoExtendPref().setDouble(DBMath.gridToLambda(gridExtendOverMin)); }// public void setExtends(int gridBaseExtend) {// int delta = gridBaseExtend - this.gridBaseExtend;// this.gridBaseExtend += delta;// for (int i = 0; i < layers.length; i++) {// Technology.ArcLayer arcLayer = layers[i];// layers[i] = arcLayer.withGridExtend(arcLayer.getGridExtend() + delta);// }// lambdaBaseExtend = DBMath.gridToLambda(gridBaseExtend);// computeLayerGridExtendRange();// } /** * Method to return the default base width of this ArcProto in lambda units. * This is the reported/selected width, which means that it does not include the width offset. * For example, diffusion arcs are always accompanied by a surrounding well and select. * This call returns only the width of the diffusion. * @return the default base width of this ArcProto in lambda units. */ public double getDefaultLambdaBaseWidth() { return DBMath.gridToLambda(getDefaultGridBaseWidth()); } /** * Method to return the factory default base width of this ArcProto in lambda units. * This is the reported/selected width, which means that it does not include the width offset. * For example, diffusion arcs are always accompanied by a surrounding well and select. * This call returns only the width of the diffusion. * @return the factory default base width of this ArcProto in lambda units. */ public double getFactoryDefaultLambdaBaseWidth() { return DBMath.gridToLambda(getFactoryDefaultGridBaseWidth()); } /** * Method to return the default base width of this ArcProto in grid units. * This is the reported/selected width, which means that it does not include the width offset. * For example, diffusion arcs are always accompanied by a surrounding well and select. * This call returns only the width of the diffusion. * @return the default base width of this ArcProto in grid units. */ public long getDefaultGridBaseWidth() { return 2*(getDefaultGridExtendOverMin() + gridBaseExtend); } /** * Method to return the factory default base width of this ArcProto in grid units. * This is the reported/selected width, which means that it does not include the width offset. * For example, diffusion arcs are always accompanied by a surrounding well and select. * This call returns only the width of the diffusion. * @return the factory default base width of this ArcProto in grid units. */ public long getFactoryDefaultGridBaseWidth() { return 2*(getFactoryDefaultGridExtendOverMin() + gridBaseExtend); } /** * Method to return the default extend of this ArcProto over minimal-width arc in base units. * This is the half of the difference between default width and minimal width. * @return the default extend of this ArcProto over minimal-width arc in base units. */ public double getDefaultLambdaExtendOverMin() { return DBMath.gridToLambda(getDefaultGridExtendOverMin()); } /** * Method to return the default extend of this ArcProto over minimal-width arc in grid units. * This is the half of the difference between default width and minimal width. * @return the default extend of this ArcProto over minimal-width arc in grid units. */ public long getDefaultGridExtendOverMin() { return DBMath.lambdaToGrid(getArcProtoExtendPref().getDouble()); } /** * Method to return the factory default extend of this ArcProto over minimal-width arc in grid units. * This is the half of the difference between default width and minimal width. * @return the default extend of this ArcProto over minimal-width arc in grid units. */ public long getFactoryDefaultGridExtendOverMin() { return DBMath.lambdaToGrid(getArcProtoExtendPref().getDoubleFactoryValue()); } /** * Method to return the base width extend of this ArcProto in lambda units. * This is the reported/selected width. * For example, diffusion arcs are always accompanied by a surrounding well and select. * This call returns only the half width of the diffusion of minimal-width arc. * @return the default base width extend of this ArcProto in lambda units. */ public double getLambdaBaseExtend() { return lambdaBaseExtend; } /** * Method to return the base width extend of this ArcProto in grid units. * This is the reported/selected width. * For example, diffusion arcs are always accompanied by a surrounding well and select. * This call returns only the half width of the diffusion of minimal-width arc. * @return the default base width extend of this ArcProto in grid units. */ public int getGridBaseExtend() { return gridBaseExtend; } /** * Method to return the width offset of this ArcProto in lambda units. * The width offset excludes the surrounding implang material. * For example, diffusion arcs are always accompanied by a surrounding well and select. * The offset amount is the difference between the diffusion width and the overall width. * @return the width offset of this ArcProto in lambda units. */ public double getLambdaElibWidthOffset() { return lambdaElibWidthOffset; } /** * Method to return the minimal layer extend of this ArcProto in grid units. * @return the minimal layer extend of this ArcProto in grid units. */ public int getMinLayerGridExtend() { return minLayerGridExtend; } /** * Method to return the maximal layer extend of this ArcProto in grid units. * @return the maximal layer extend of this ArcProto in grid units. */ public int getMaxLayerGridExtend() { return maxLayerGridExtend; } /* private Pref getArcProtoAntennaPref() { Pref pref = defaultAntennaRatioPrefs.get(this); if (pref == null) { double factory = ERCAntenna.DEFPOLYRATIO; if (function.isMetal()) factory = ERCAntenna.DEFMETALRATIO; pref = Pref.makeDoublePref("DefaultAntennaRatioFor" + protoName + "IN" + tech.getTechName(), ERC.tool.prefs, factory); defaultAntennaRatioPrefs.put(this, pref); } return pref; } */ /** * Method to set the antenna ratio of this ArcProto. * Antenna ratios are used in antenna checks that make sure the ratio of the area of a layer is correct. * @param ratio the antenna ratio of this ArcProto. */ //public void setAntennaRatio(double ratio) { getArcProtoAntennaPref().setDouble(ratio); } /** * Method to tell the antenna ratio of this ArcProto. * Antenna ratios are used in antenna checks that make sure the ratio of the area of a layer is correct. * @return the antenna ratio of this ArcProto. */ //public double getAntennaRatio() { return getArcProtoAntennaPref().getDouble(); } private Pref getArcProtoBitPref(String what, HashMap<ArcProto,Pref> map, boolean factory) { Pref pref = map.get(this); if (pref == null) { pref = Pref.makeBooleanPref("Default" + what + "For" + getName() + "IN" + tech.getTechName(), tech.getTechnologyUserPreferences(), factory); map.put(this, pref); } return pref; } /** * Method to set the "factory default" rigid state of this ArcProto. * Rigid arcs cannot change length or the angle of their connection to a NodeInst. * @param rigid true if this ArcProto should be rigid by factory-default. */ public void setFactoryRigid(boolean rigid) { getArcProtoBitPref("Rigid", defaultRigidPrefs, rigid); } /** * Method to set the rigidity of this ArcProto. * Rigid arcs cannot change length or the angle of their connection to a NodeInst. * @param rigid true if new instances of this ArcProto should be rigid. */ public void setRigid(boolean rigid) { getArcProtoBitPref("Rigid", defaultRigidPrefs, false).setBoolean(rigid); } /** * Method to tell if instances of this ArcProto are rigid. * Rigid arcs cannot change length or the angle of their connection to a NodeInst. * @return true if instances of this ArcProto are rigid. */ public boolean isRigid() { return getArcProtoBitPref("Rigid", defaultRigidPrefs, false).getBoolean(); } /** * Method to tell if instances of this ArcProto are rigid by default. * Rigid arcs cannot change length or the angle of their connection to a NodeInst. * @return true if instances of this ArcProto are rigid by default. */ public boolean isFactoryRigid() { return getArcProtoBitPref("Rigid", defaultRigidPrefs, false).getBooleanFactoryValue(); } /** * Method to set the "factory default" fixed-angle state of this ArcProto. * Fixed-angle arcs cannot change their angle, so if one end moves, * the other may also adjust to keep the arc angle constant. * @param fixed true if this ArcProto should be fixed-angle by factory-default. */ public void setFactoryFixedAngle(boolean fixed) { getArcProtoBitPref("FixedAngle", defaultFixedAnglePrefs, fixed); } /** * Method to set the fixed-angle state of this ArcProto. * Fixed-angle arcs cannot change their angle, so if one end moves, * the other may also adjust to keep the arc angle constant. * @param fixed true if new instances of this ArcProto should be fixed-angle. */ public void setFixedAngle(boolean fixed) { getArcProtoBitPref("FixedAngle", defaultFixedAnglePrefs, true).setBoolean(fixed); } /** * Method to tell if instances of this ArcProto are fixed-angle. * Fixed-angle arcs cannot change their angle, so if one end moves, * the other may also adjust to keep the arc angle constant. * @return true if instances of this ArcProto are fixed-angle. */ public boolean isFixedAngle() { return getArcProtoBitPref("FixedAngle", defaultFixedAnglePrefs, true).getBoolean(); } /** * Method to tell if instances of this ArcProto are fixed-angle by default. * Fixed-angle arcs cannot change their angle, so if one end moves, * the other may also adjust to keep the arc angle constant. * @return true if instances of this ArcProto are fixed-anglee by default. */ public boolean isFactoryFixedAngle() { return getArcProtoBitPref("FixedAngle", defaultFixedAnglePrefs, true).getBooleanFactoryValue(); } /** * Method to set the "factory default" slidability state of this ArcProto. * Arcs that slide will not move their connected NodeInsts if the arc's end is still within the port area. * Arcs that cannot slide will force their NodeInsts to move by the same amount as the arc. * Rigid arcs cannot slide but nonrigid arcs use this state to make a decision. * @param slidable true if this ArcProto should be slidability by factory-default. */ public void setFactorySlidable(boolean slidable) { getArcProtoBitPref("Slidable", defaultSlidablePrefs, slidable); } /** * Method to set the slidability of this ArcProto. * Arcs that slide will not move their connected NodeInsts if the arc's end is still within the port area. * Arcs that cannot slide will force their NodeInsts to move by the same amount as the arc. * Rigid arcs cannot slide but nonrigid arcs use this state to make a decision. * @param slidable true if new instances of this ArcProto should be slidable. */ public void setSlidable(boolean slidable) { getArcProtoBitPref("Slidable", defaultSlidablePrefs, true).setBoolean(slidable); } /** * Method to tell if instances of this ArcProto are slidable. * Arcs that slide will not move their connected NodeInsts if the arc's end is still within the port area. * Arcs that cannot slide will force their NodeInsts to move by the same amount as the arc. * Rigid arcs cannot slide but nonrigid arcs use this state to make a decision. * @return true if instances of this ArcProto are slidable. */ public boolean isSlidable() { return getArcProtoBitPref("Slidable", defaultSlidablePrefs, true).getBoolean(); } /** * Method to tell if instances of this ArcProto are slidable by default. * Arcs that slide will not move their connected NodeInsts if the arc's end is still within the port area. * Arcs that cannot slide will force their NodeInsts to move by the same amount as the arc. * Rigid arcs cannot slide but nonrigid arcs use this state to make a decision. * @return true if instances of this ArcProto are slidable by default. */ public boolean isFactorySlidable() { return getArcProtoBitPref("Slidable", defaultSlidablePrefs, true).getBooleanFactoryValue(); } /** * Method to set the "factory default" end-extension state of this ArcProto. * End-extension causes an arc to extend past its endpoint by half of its width. * Most layout arcs want this so that they make clean connections to orthogonal arcs. * @param extended true if this ArcProto should be end-extended by factory-default. */ public void setFactoryExtended(boolean extended) { getArcProtoBitPref("Extended", defaultExtendedPrefs, extended); } /** * Method to set the end-extension factor of this ArcProto. * End-extension causes an arc to extend past its endpoint by half of its width. * Most layout arcs want this so that they make clean connections to orthogonal arcs. * @param extended true if new instances of this ArcProto should be end-extended. */ public void setExtended(boolean extended) { getArcProtoBitPref("Extended", defaultExtendedPrefs, true).setBoolean(extended); } /** * Method to tell if instances of this ArcProto have their ends extended. * End-extension causes an arc to extend past its endpoint by half of its width. * Most layout arcs want this so that they make clean connections to orthogonal arcs. * @return true if instances of this ArcProto have their ends extended. */ public boolean isExtended() { return getArcProtoBitPref("Extended", defaultExtendedPrefs, true).getBoolean(); } /** * Method to tell if instances of this ArcProto have their ends extended by default. * End-extension causes an arc to extend past its endpoint by half of its width. * Most layout arcs want this so that they make clean connections to orthogonal arcs. * @return true if instances of this ArcProto have their ends extended by default. */ public boolean isFactoryExtended() { return getArcProtoBitPref("Extended", defaultExtendedPrefs, true).getBooleanFactoryValue(); } /** * Method to set the directional factor for this ArcProto. * Directional arcs have an arrow drawn on them to indicate flow. * It is only for documentation purposes and does not affect the circuit. * @param directional true if new instances of this ArcProto should be directional. */ public void setDirectional(boolean directional) { getArcProtoBitPref("Directional", defaultDirectionalPrefs, false).setBoolean(directional); } /** * Method to tell if instances of this ArcProto are directional. * Directional arcs have an arrow drawn on them to indicate flow. * It is only for documentation purposes and does not affect the circuit. * @return true if instances of this ArcProto are directional. */ public boolean isDirectional() { return getArcProtoBitPref("Directional", defaultDirectionalPrefs, false).getBoolean(); } /** * Method to tell if instances of this ArcProto are directional by default. * Directional arcs have an arrow drawn on them to indicate flow. * It is only for documentation purposes and does not affect the circuit. * @return true if instances of this ArcProto are directional by default. */ public boolean isFactoryDirectional() { return getArcProtoBitPref("Directional", defaultDirectionalPrefs, false).getBooleanFactoryValue(); } /** * Method to set this ArcProto so that it is not used. * Unused arcs do not appear in the component menus and cannot be created by the user. * The state is useful for hiding arcs that the user should not use. * @param set */ public void setNotUsed(boolean set) { /* checkChanging();*/ if (set) userBits |= ANOTUSED; else userBits &= ~ANOTUSED; if (arcPin != null) arcPin.setNotUsed(set); } /** * Method to tell if this ArcProto is used. * Unused arcs do not appear in the component menus and cannot be created by the user. * The state is useful for hiding arcs that the user should not use. * @return true if this ArcProto is used. */ public boolean isNotUsed() { return (userBits & ANOTUSED) != 0; } /** * Method to set this ArcProto to be completely invisible, and unselectable. * When all of its layers have been made invisible, the node is flagged to be invisible. * @param invisible true to set this ArcProto to be completely invisible and unselectable. */ public void setArcInvisible(boolean invisible) { if (invisible) userBits |= AINVISIBLE; else userBits &= ~AINVISIBLE; }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -