// graphextract.beh // Last modified - Mar 12 '98 , binoy // Author - Kedar Patankar // This program extracts information from graph object to build netlist for display // in apstudio //*******************Class Program********************************/ Program { traversal checkParents(DummyVisitor dv) { to {Superclasses, Interfaces}; } (@ public void check_classparents() { DummyVisitor dv= new DummyVisitor(); checkParents(dv); } @) } DummyVisitor { before Superclasses (@ throw new UnsupportedSyntaxException("APStudio doesn't support \"extends\" in class dictionaries"); @) before Interfaces (@ throw new UnsupportedSyntaxException("APStudio doesn't support interfaces in class dictionaries"); @) } //****************************************************************/ //*******************Class UGraph ********************************/ UGraph { traversal ReadAllVertices(ReadVertexVisitor rvv) { bypassing -> *,edges,* to { UConstVertex, UAltVertex, UTermConstVertex}; } (@ public VertexContainer GetAllVertices() { ReadVertexVisitor rvv = new ReadVertexVisitor( new VertexContainer(new Vector(),new Vector(),new Vector())); this.ReadAllVertices(rvv); return rvv.get_elements(); } @) traversal ReadAllEdges(ReadEdgeVisitor rev) { bypassing -> *,vertices,* to { UConstEdge, UAltEdge}; } (@ public EdgeContainer GetAllEdges() { ReadEdgeVisitor rev= new ReadEdgeVisitor( new EdgeContainer(new Vector(),new Vector())); this.ReadAllEdges(rev); return rev.get_elements(); } @) } //******************end class UGraph************************************/ //*************************************************************************************/ //******************* VISITORS USED IN THE APPLCIATION ********************************/ //*************************************************************************************/ //******************ReadEdgeVisitor************************************/ ReadEdgeVisitor { before UAltEdge (@ UID from=host.get_fromVertex(); UID to=host.get_toVertex(); UID uid=host.get_eid(); Point bendPoint; if(host.get_bendpoint()==null) bendPoint = null; else { BendPoint bp = host.get_bendpoint(); int x = bp.get_position().get_x().get_x().intValue(); int y = bp.get_position().get_y().get_y().intValue(); bendPoint=new Point(x,y); } EdgeInfo edgeinfo = new EdgeInfo(null,null,null,null,from, to,uid,bendPoint); elements.get_alternation().addElement(edgeinfo); @) before UConstEdge (@ String edge_name = null; if(host.get_edgename()!=null) edge_name=host.get_edgename().get_name().toString(); String card = host.get_card().get_lower().get_l() + (host.get_card().get_upper()==null?"":".."+host.get_card().get_upper().get_u()); UID from=host.get_fromVertex(); UID to=host.get_toVertex(); UID uid=host.get_eid(); String before; if(host.get_beFore()==null) before = null; else before=host.get_beFore().get_syntax(); String after; if(host.get_afTer()==null) after = null; else after=host.get_afTer().get_syntax(); Point bendPoint; if(host.get_bendpoint()==null) bendPoint = null; else { BendPoint bp = host.get_bendpoint(); int x = bp.get_position().get_x().get_x().intValue(); int y = bp.get_position().get_y().get_y().intValue(); bendPoint=new Point(x,y); } EdgeInfo edgeinfo = new EdgeInfo(edge_name,card,before,after,from, to,uid,bendPoint); elements.get_construction().addElement(edgeinfo); @) } //******************end class ReadEdgeVisitor************************************/ //******************ReadVertexVisitor********************************/ ReadVertexVisitor { before UAltVertex (@ String vertex_name=host.get_vertexname().get_name().toString(); Integer vertex_x=host.get_position().get_x().get_x(); Integer vertex_y=host.get_position().get_y().get_y(); Point p = new Point(vertex_x.intValue(), vertex_y.intValue()); UID uid=host.get_vid(); VertexInfo vertexinfo = new VertexInfo (uid,vertex_name, p); elements.get_alternation().addElement(vertexinfo); @) before UConstVertex (@ String vertex_name=host.get_vertexname().get_name().toString(); Integer vertex_x=host.get_position().get_x().get_x(); Integer vertex_y=host.get_position().get_y().get_y(); Point p = new Point(vertex_x.intValue(), vertex_y.intValue()); UID uid=host.get_vid(); String before,after; if(host.get_beFore()==null) before = null; else before=host.get_beFore().get_syntax(); if(host.get_afTer()==null) after=null; else after=host.get_afTer().get_syntax(); VertexInfo _vertexinfo = new VertexInfo (uid,vertex_name, p,before,after); elements.get_construction().addElement(_vertexinfo); @) before UTermConstVertex (@ String vertex_name=host.get_vertexname().get_name().toString(); Integer vertex_x=host.get_position().get_x().get_x(); Integer vertex_y=host.get_position().get_y().get_y(); Point p = new Point(vertex_x.intValue(), vertex_y.intValue()); UID uid=host.get_vid(); VertexInfo _vertexinfo = new VertexInfo (uid,vertex_name, p); elements.get_construction().addElement(_vertexinfo); @) } //******************end class ReadVertexVisitor********************************/ Package { /* String getString() to DirName { init (@ return_val = null; @) before DirName (@ if(return_val == null) return_val = host.get_name().toString(); else return_val = return_val + "." + host.get_name().toString(); @) }*/ }