cppFixEdgeObjs
UseCase2
// COM1205 Propagation Pattern for DemDraw project
//
// Created by Tom Kneeland (tomk@ccs.neu.edu)
//
// This propagation pattern traverses all the edge objects stored in the
// edges list, and associates its from and to data members with real vertex
// objects based on the tempory vertex objects stored in the from and to
// data mambers. These tempory objects are automatically created when an
// input file is loaded using g_parse().
// cppLookUpVName is used with each tempory vertex's name to find the
// proper real vertex.
*operation* void cppFixEdgeObjs()
*traverse*
*from* Graph
*to* Edge
*carry* *in* Graph* tmpGraph = (@ this @)
*along* *from* Graph *to* Edge
*wrapper* Edge
(@
// Pointer to the tempory vertex.
Vertex* wrongVert;
//Get the name of the tempory vertex.
DemIdent* name = this->get_from()->get_vertexname()->get_name();
//Point the datamember to the real vertex.
wrongVert = rset_from(tmpGraph->cppLookUpVName(name));
//Delete the tempory vertex object.
delete wrongVert;
//Get the name of the tempory vertex.
name = this->get_to()->get_vertexname()->get_name();
//Point the datamember to the real vertex.
wrongVert = rset_to(tmpGraph->cppLookUpVName(name));
//Delete the tempory vertex object.
delete wrongVert;
@)