cdgAddCNeighbor

UseCase3



// COM1205 Propagation Pattern for DemDraw Project
//
// Created 11/29/95 by Young Soo Yang (yyang@ccs.neu.edu)
//
// Look for the source vertex in the list of adjacencies. If found,
// add the given adjacency based on the type of the neighbor list.
// For instance, if the source is an alternation vertex, the
// destination vertex should be added to the "common" list.


*operation* void cdgAddCNeighbor(DemIdent* SrcVert,
                                 DemIdent* Name,
                                 DemIdent* DesVert)
   *traverse*
      *from* Cd_Graph
         *through* -> *,ns,*, -> *,construct_ns,*
      *to*   Cd_LV_List

   *carry* *in* Cd_Vertex* S_Chk_Vert = (@ this -> get_source() @)
      *along* *from* Cd_Adjacency
                 *through* -> *,ns,*, -> *,construct_ns,*
              *to*   Cd_LV_List

   *wrapper* Cd_LV_List
      (@
         if (SrcVert->g_equal(S_Chk_Vert->get_vertex_name())) {

            Cd_LVertex* new_LVertex = new Cd_LVertex();

            new_LVertex->set_vertex(new Cd_Vertex((DemIdent*)DesVert->g_copy()));
            new_LVertex->set_label_name((DemIdent*)Name->g_copy());

            this->append(new_LVertex);
         }
      @)