/** * BasicCell * * BasicCells are OctInstances, and can generate * their master cell. * * @version $Id$ * @author Michael Shilman */ import java.awt.*; public class BasicCell extends OctInstance { /** * This is your unique master cell, which is * filled in in initClass(). */ public static OctCell m_master = null; /** * This is your unique master cell's name. You should * change the name to something unique to you, * such as "yourloginBasicCell". */ public static String m_cellName = "JimmyJacksonCellName"; /** * Constructor. Note that BasicCell.initClass() must be * called before any BasicCell can be instantiated. */ BasicCell(OctCell env, OctTransform xf, String name, String master, String view, String facet, int version) { super(env, xf, name, master, view, facet, version); // If our master has not been created in // the database, do it OctView v = null; /* If you want to use the network database, make * initGen calls to make sure that objects are in * memory. For the default version this is not * necessary. * if(m_master.InitGenContents() == OCT.OK) { * //traverse here * } */ for(int i = 0; i < m_master.contents.size(); i++) { OctObject obj = (OctObject) m_master.contents.elementAt(i); if(obj instanceof OctView) { v = (OctView)obj; if(v.name.compareTo("schematic") == 0) break; } } if(v == null) { DEBUG("NO SCHEMATIC VIEW FOUND!!!"); } else { OctFacet f = null; //v.initGen... for(int i = 0; i < v.contents.size(); i++) { OctObject obj = (OctObject) v.contents.elementAt(i); if(obj instanceof OctFacet) { f = (OctFacet)obj; if(f.facet.compareTo("interface") == 0) break; } } if(f == null) { DEBUG("NO INTERFACE FACET FOUND!!!"); } else { for(int i = 0; i < f.contents.size(); i++) { OctObject obj = (OctObject)f.contents.elementAt(i); if(obj instanceof OctBox) { OctBox b1 = (OctBox)obj; OctBox b2 = new OctBox(env, new OctPoint(env, b1.lowerLeft.x, b1.lowerLeft.y), new OctPoint(env, b1.upperRight.x, b1.upperRight.y)); this.Attach(b2); } else if(obj instanceof OctTerm) { OctTerm t1 = (OctTerm)obj; OctTerm t2 = new OctTerm(env, t1.name, t1.objectId, 0 /*not needed*/, t1.width); this.Attach(t2); } } } } } /** * Create BasicCell's master OctCell (it's schema) */ public static void initClass() { m_master = new OctCell(m_cellName, "password2", "W"); OctView sView = new OctView(m_master, "schematic"); m_master.Attach(sView); OctFacet iFacet = new OctFacet(m_master, "BasicCell", "schematic", "interface", OCT.CURRENT_VERSION, OCT.WRITE); sView.Attach(iFacet); // instanceId = NULL_ID and formalExternalId = 0 // since the terminal is a formal (not actual) terminal OctTerm in1 = new OctTerm(m_master, "in1", OCT.NULL_ID, 0, 1); OctTerm in2 = new OctTerm(m_master, "in2", OCT.NULL_ID, 0, 1); OctTerm out = new OctTerm(m_master, "out", OCT.NULL_ID, 0, 1); iFacet.Attach(in1); iFacet.Attach(in2); iFacet.Attach(out); OctPoint lowerLeftPt = new OctPoint(m_master, 0, 0); OctPoint upperRightPt = new OctPoint(m_master, 40, 30); OctBox box = new OctBox(m_master, lowerLeftPt, upperRightPt); iFacet.Attach(box); } }