@@ -118,8 +118,27 @@ public EDIFCell(EDIFLibrary lib, EDIFCell orig) {
118118 */
119119 public EDIFCell (EDIFLibrary lib , EDIFCell orig , String newCellName ) {
120120 super (newCellName );
121+ deepCopyInit (lib , orig , newCellName , true );
122+ }
123+
124+ /**
125+ * Full Deep Copy Constructor with rename and optional inclusion of nets and
126+ * insts
127+ *
128+ * @param lib Destination library of the new cell
129+ * @param orig Prototype of the original cell
130+ * @param newCellName Name of the new cell copy
131+ * @param includeNetsAndInsts In the deep copy, include copies of all the nets
132+ * and instances
133+ */
134+ public EDIFCell (EDIFLibrary lib , EDIFCell orig , String newCellName , boolean includeNetsAndInsts ) {
135+ super (newCellName );
136+ deepCopyInit (lib , orig , newCellName , includeNetsAndInsts );
137+ }
138+
139+ private void deepCopyInit (EDIFLibrary lib , EDIFCell orig , String newCellName , boolean includeNetsAndInsts ) {
121140 if (lib != null ) lib .addCell (this );
122- if (orig .instances != null ) {
141+ if (includeNetsAndInsts && orig .instances != null ) {
123142 for (Entry <String , EDIFCellInst > e : orig .instances .entrySet ()) {
124143 addCellInst (new EDIFCellInst (e .getValue (), this ));
125144 }
@@ -129,7 +148,7 @@ public EDIFCell(EDIFLibrary lib, EDIFCell orig, String newCellName) {
129148 addPort (new EDIFPort (e .getValue ()));
130149 }
131150 }
132- if (orig .nets != null ) {
151+ if (includeNetsAndInsts && orig .nets != null ) {
133152 for (Entry <String , EDIFNet > e : orig .nets .entrySet ()) {
134153 EDIFNet net = addNet (new EDIFNet (e .getValue ()));
135154 for (EDIFPortInst prototype : e .getValue ().getPortInsts ()) {
0 commit comments