cppRenEdge.html
UseCase3
// COM1205 Propagation Pattern for DemDraw Project.
//
// Created by Young Soo Yang (yyang@ccs.neu.edu)
//
// This propagation pattern will traverse all the edges stored in a
// Graph object to rename a construction edge.
// To do this, it checks three conditions first,
//
// 1. checks old label name by calling cppCompEdgeName() propagation
// pattern with argument Labelname
// 2. checks source vertex name of an edge by calling cppCompVertName()
// propagation pattern with argument SrcLabelname.
// 3. checks destination vertex name by calling cppCompVertName() propagation
// pattern with argument DesLabelname.
//
// If they are all satisfied, it changes the edge name to NewLabelname by
// calling cppSetEdgeName() and returns 1 to the caller, otherwise, returns 0.
//
// Modification History:
//
// 11/25/95 - Young Soo Yang (yyang@ccs.neu.edu)
// Modified to make it more structure shy - using g_equal & g_delete
// instead of strcmp & delete.
//
*operation* int cppRenEdge(char* Labelname, char* SrcLabelname,
char* DesLabelname, char* NewLabelname)
*init* (@ 0 @)
*traverse*
*from* Graph
*through* -> *,edges,*
*to* ConstEdge
*wrapper* Graph
*suffix*
(@
this -> cppDrawVertices();
this -> cppDrawEdges();
@)
*wrapper* ConstEdge
(@
if (this->cppCompEdgeName(Labelname) &&
this->get_from()->cppCompVertName(SrcLabelname) &&
this->get_to()->cppCompVertName(DesLabelname)) {
this->cppSetEdgeName(NewLabelname);
return_val = 1;
}
@)