// Check consistency of parameterized classes *operation* int check_parameters() *init* (@ 1 @) *traverse* *from* Cd_graph *to* Term *carry* *in* Cd_graph* graph = (@ this @) *along* *from* Cd_graph *to* Term *wrapper* Cd_graph *prefix* (@ cout << endl << "Checking that every parameterized class is " << "consistently" << endl << "\tdefined and used ..." << endl; @) *wrapper* Term *prefix* (@ int num_actuals = 0; int num_params = 0; Adjacency* adjclass; if (this->get_actual_parameters() != NULL) { num_actuals = this->get_actual_parameters()-> check_parameters1(); } adjclass = graph->find_adjacency(this->get_vertex()); if (adjclass != NULL) { num_params = adjclass->check_parameters2(); if (num_params != num_actuals) { cout << "sem-check: error: inconsistent number of " << "parameters" << endl << "\tfor class '"; this->get_vertex()->g_print(); cout << "' on line " << this->find_line_number() << endl << "\texpected " << num_params << " found " << num_actuals << " parameters" << endl; return_val = 0; } } @) // Count the number of actual parameters *operation* int check_parameters1() *init* (@ 0 @) *traverse* *from* Term_Comma_list *to-stop* Term *wrapper* Term *prefix* (@ return_val++; @) // Count the number of formal parameters *operation* int check_parameters2() *init* (@ 0 @) *traverse* *from* Adjacency *through* ->Adjacency,*,Vertex_Comma_list *bypassing* ->Adjacency,*,Neighbors *to* Vertex *wrapper* Vertex *prefix* (@ return_val++; @)