📄 arcinst.java
字号:
*/ public void setBodyArrowed(boolean state) { setFlag(ImmutableArcInst.BODY_ARROWED, state); } /** * Method to tell whether an end of ArcInst has its ends extended. * Extended arcs continue past their endpoint by half of their width. * Most layout arcs want this so that they make clean connections to orthogonal arcs. * @param connIndex TAILEND (0) for the tail of this ArcInst, HEADEND (1) for the head. * @return true if that end of this ArcInst iss extended. */ public boolean isExtended(int connIndex) { return d.isExtended(connIndex); } /** * Method to tell whether the tail of this arc is extended. * Extended arcs continue past their endpoint by half of their width. * Most layout arcs want this so that they make clean connections to orthogonal arcs. * @return true if the tail of this arc is extended. */ public boolean isTailExtended() { return d.isTailExtended(); } /** * Method to tell whether the head of this arc is extended. * Extended arcs continue past their endpoint by half of their width. * Most layout arcs want this so that they make clean connections to orthogonal arcs. * @return true if the head of this arc is extended. */ public boolean isHeadExtended() { return d.isHeadExtended(); } /** * Method to set whether an end of this arc is extended. * Extended arcs continue past their endpoint by half of their width. * Most layout arcs want this so that they make clean connections to orthogonal arcs. * @param connIndex TAILEND (0) for the tail of this ArcInst, HEADEND (1) for the head. * @param e true to set that end of this arc to be extended. */ public void setExtended(int connIndex, boolean e) { switch (connIndex) { case ImmutableArcInst.TAILEND: setTailExtended(e); break; case ImmutableArcInst.HEADEND: setHeadExtended(e); break; default: throw new IllegalArgumentException("Bad end " + connIndex); } } /** * Method to set whether the tail of this arc is extended. * Extended arcs continue past their endpoint by half of their width. * Most layout arcs want this so that they make clean connections to orthogonal arcs. * @param e true to set the tail of this arc to be extended. */ public void setTailExtended(boolean e) { setFlag(ImmutableArcInst.TAIL_EXTENDED, e);// if (isLinked()) updateGeometric(); } /** * Method to set whether the head of this arc is extended. * Extended arcs continue past their endpoint by half of their width. * Most layout arcs want this so that they make clean connections to orthogonal arcs. * @param e true to set the head of this arc to be extended. */ public void setHeadExtended(boolean e) { setFlag(ImmutableArcInst.HEAD_EXTENDED, e);// if (isLinked()) updateGeometric(); } /** * Method to tell whether an end of this arc is negated. * Negated arc have a negating bubble on them to indicate negation. * This is only valid in schematics technologies. * @param connIndex TAILEND (0) for the tail of this ArcInst, HEADEND (1) for the head. * @return true if set that end of this arc is negated. */ public boolean isNegated(int connIndex) { return d.isNegated(connIndex); } /** * Method to tell whether the tail of this arc is negated. * Negated arc have a negating bubble on them to indicate negation. * This is only valid in schematics technologies. * @return true if set the tail of this arc is negated. */ public boolean isTailNegated() { return d.isTailNegated(); } /** * Method to tell whether the head of this arc is negated. * Negated arc have a negating bubble on them to indicate negation. * This is only valid in schematics technologies. * @return true if set the head of this arc is negated. */ public boolean isHeadNegated() { return d.isHeadNegated(); } /** * Method to set whether an end of this arc is negated. * Negated arc have a negating bubble on them to indicate negation. * This is only valid in schematics technologies. * @param connIndex TAILEND (0) for the tail of this ArcInst, HEADEND (1) for the head. * @param n true to set that end of this arc to be negated. */ public void setNegated(int connIndex, boolean n) { switch (connIndex) { case ImmutableArcInst.TAILEND: setTailNegated(n); break; case ImmutableArcInst.HEADEND: setHeadNegated(n); break; default: throw new IllegalArgumentException("Bad end " + connIndex); } } /** * Method to set whether the tail of this arc is negated. * Negated arc have a negating bubble on them to indicate negation. * This is only valid in schematics technologies. * @param n true to set the tail of this arc to be negated. */ public void setTailNegated(boolean n) { if (!(d.tailPortId instanceof PrimitivePortId && getTechPool().getPrimitivePort((PrimitivePortId)d.tailPortId).isNegatable())) n = false; if (getProto().getTechnology().isNoNegatedArcs()) n = false; setFlag(ImmutableArcInst.TAIL_NEGATED, n); } /** * Method to set whether the head of this arc is negated. * Negated arc have a negating bubble on them to indicate negation. * This is only valid in schematics technologies. * @param n true to set the head of this arc to be negated. */ public void setHeadNegated(boolean n) { if (!(d.headPortId instanceof PrimitivePortId && getTechPool().getPrimitivePort((PrimitivePortId)d.headPortId).isNegatable())) n = false; if (getProto().getTechnology().isNoNegatedArcs()) n = false; setFlag(ImmutableArcInst.HEAD_NEGATED, n); } /****************************** MISCELLANEOUS ******************************/ /** * Method to check and repair data structure errors in this ArcInst. */ public int checkAndRepair(boolean repair, List<Geometric> list, ErrorLogger errorLogger) { int errorCount = 0; ArcProto ap = getProto(); if (ap.isNotUsed()) {// if (repair) if (errorLogger != null) { String msg = "Prototype of arc " + getName() + " is unused"; if (repair) { // Can't put this arc into error logger because it will be deleted. Poly poly = makeLambdaPoly(getGridBaseWidth(), Poly.Type.CLOSED); errorLogger.logError(msg, poly, parent, 1); } else { errorLogger.logError(msg, this, parent, null, 1); } } if (repair) list.add(this); // This counts as 1 error, ignoring other errors return 1; } // see if the ends are in their ports if (!headStillInPort(d.headLocation, false)) { Poly poly = headPortInst.getPoly(); String msg = parent + ", " + this + ": head not in port, is at (" + d.headLocation.getX() + "," + d.headLocation.getY() + ") distance to port is " + poly.polyDistance(d.headLocation.getX(), d.headLocation.getY()) + " port center is (" + poly.getCenterX() + "," + poly.getCenterY() + ")"; System.out.println(msg); if (errorLogger != null) { if (repair) { errorLogger.logError(msg, Collections.singletonList((Geometric)headPortInst.getNodeInst()), null, null, null, Collections.singletonList((PolyBase)makeLambdaPoly(getGridBaseWidth(), Poly.Type.CLOSED)), parent, 1); } else { List<Geometric> geomList = new ArrayList<Geometric>(); geomList.add(this); geomList.add(headPortInst.getNodeInst()); errorLogger.logError(msg, geomList, null, parent, 1); } } if (repair) { Constraints.getCurrent().modifyArcInst(this, getD());// setD(d.withLocations(d.tailLocation, new EPoint(poly.getCenterX(), poly.getCenterY())), false);// updateGeometric(); } errorCount++; } if (!tailStillInPort(d.tailLocation, false)) { Poly poly = tailPortInst.getPoly(); String msg = parent + ", " + this + ": tail not in port, is at (" + d.tailLocation.getX() + "," + d.tailLocation.getY() + ") distance to port is " + poly.polyDistance(d.tailLocation.getX(), d.tailLocation.getY()) + " port center is (" + poly.getCenterX() + "," + poly.getCenterY() + ")"; System.out.println(msg); if (errorLogger != null) { if (repair) { errorLogger.logError(msg, Collections.singletonList((Geometric)tailPortInst.getNodeInst()), null, null, null, Collections.singletonList((PolyBase)makeLambdaPoly(getGridBaseWidth(), Poly.Type.CLOSED)), parent, 1); } else { List<Geometric> geomList = new ArrayList<Geometric>(); geomList.add(this); geomList.add(tailPortInst.getNodeInst()); errorLogger.logError(msg, geomList, null, parent, 1); } } if (repair) { Constraints.getCurrent().modifyArcInst(this, getD());// setD(d.withLocations(new EPoint(poly.getCenterX(), poly.getCenterY()), d.headLocation), false);// updateGeometric(); } errorCount++; } return errorCount; } /** * Method to check invariants in this ArcInst. * @exception AssertionError if invariants are not valid */ public void check(Poly.Builder polyBuilder) { if (topology.validArcBounds && Job.getDebug()) { double minX = Double.POSITIVE_INFINITY, minY = Double.POSITIVE_INFINITY; double maxX = Double.NEGATIVE_INFINITY, maxY = Double.NEGATIVE_INFINITY; for (Iterator<Poly> it = getShape(polyBuilder); it.hasNext(); ) { Poly poly = it.next(); Rectangle2D bounds = poly.getBounds2D(); minX = Math.min(minX, bounds.getMinX()); minY = Math.min(minY, bounds.getMinY()); maxX = Math.max(maxX, bounds.getMaxX()); maxY = Math.max(maxY, bounds.getMaxY()); } minX = GenMath.floorLong(minX); minY = GenMath.floorLong(minY); maxX = GenMath.ceilLong(maxX); maxY = GenMath.ceilLong(maxY); assert visBounds.getX() == DBMath.gridToLambda(minX); assert visBounds.getY() == DBMath.gridToLambda(minY); assert visBounds.getWidth() == DBMath.gridToLambda(maxX - minX); assert visBounds.getHeight() == DBMath.gridToLambda(maxY - minY); } } /** * Method to get the arcId of this ArcInst. * The arcId is assign to ArcInst in chronological order * The arcId doesn't relate to alpahnumeric ordering of arcs in the Cell. * @return the index of this ArcInst. */ public final int getArcId() { return d.arcId; } /** * Returns true if this ArcInst is linked into database. * @return true if this ArcInst is linked into database. */ public boolean isLinked() { try { return parent != null && parent.isLinked() && parent.getArcById(getArcId()) == this; } catch (IndexOutOfBoundsException e) { return false; } } /** * Method to return the prototype of this ArcInst. * @return the prototype of this ArcInst. */ public ArcProto getProto() { return getTechPool().getArcProto(d.protoId); } /** * Copies all properties (variables, constraints, and textdescriptor) * from 'fraomAi' to this arcinst. This is basically the same as calling * copyVarsFrom(), copyConstraintsFrom(), and setTextDescriptor(). * @param fromAi the arc from which to copy all arc properties */ public void copyPropertiesFrom(ArcInst fromAi) { if (fromAi == null) return; copyVarsFrom(fromAi); copyConstraintsFrom(fromAi); copyTextDescriptorFrom(fromAi, ArcInst.ARC_NAME); } /** * Copies constraints (Rigid, Ends Extended, etc) from another arcinst to this arcinst * It copies also attributes of Connections (arrow/negated/extended) * @param fromAi the arcinst from which to copy constraints */ public void copyConstraintsFrom(ArcInst fromAi) { checkChanging(); if (fromAi == null) return; ImmutableArcInst oldD = d; int flags = fromAi.d.flags; if (!(d.tailPortId instanceof PrimitivePortId && getTechPool().getPrimitivePort((PrimitivePortId)d.tailPortId).isNegatable())) flags = ImmutableArcInst.TAIL_NEGATED.set(flags, false); if (!(d.headPortId instanceof PrimitivePortId && getTechPool().getPrimitivePort((PrimitivePortId)d.headPortId).isNegatable())) flags = ImmutableArcInst.HEAD_NEGATED.set(flags, false); if (getProto().getTechnology().isNoNegatedArcs()) { flags = ImmutableArcInst.TAIL_NEGATED.set(flags, false); flags = ImmutableArcInst.HEAD_NEGATED.set(flags, false); } lowLevelModify(d.withFlags(flags).withAngle(fromAi.getAngle())); if (parent != null) Constraints.getCurrent().modifyArcInst(this, oldD); }// /**// * Low-level method to get the user bits.// * The "user bits" are a collection of flags that are more sensibly accessed// * through special methods.// * This general access to the bits is required because the ELIB// * file format stores it as a full integer.// * This should not normally be called by any other part of the system.// * @return the "user bits".// */// public int lowLevelGetUserbits() { return userBits; }//// /**// * Low-level method to set the user bits.// * The "user bits" are a collection of flags that are more sensibly accessed// * through special methods.// * This general access to the bits is required because the ELIB// * file format stores it as a full int
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -