#include "cdabs.h" // This file contains functions to find out whether one adjacency generalizes the other. int Adjacency::generalize(Adjacency* adj, Adjacency_Nlist* anl1, Adjacency_Nlist* anl2) // Function to find out whether one adjacency generalizes the other. { char* this_type = (char *)ns->get_type(); char* adj_type = adj->ns_type(); if (!(strcmp(this_type,adj_type))) /* same type - return false */ return(FALSE); if (adj->is_alns()) if (((Alternat_ns*)adj->get_ns())->alt_reach(source,this_type,anl1)) return(SUB); /* this is a subclass of adj */ else return (FALSE); if (this->is_alns()) if (((Alternat_ns*)ns)->alt_reach(adj->get_source(),adj_type,anl2)) return(SUP); /* this is a superclass */ return (FALSE); } int Alternat_ns::alt_reach(Vertex* v, char* v_type, Adjacency_Nlist* anl) // Function to check whether the given vertex is alternate-reachable from this Alternate class { return (alternat_ns->alt_reach(v,v_type,anl)); } int Term_Bar_list::alt_reach(Vertex* v, char* v_type, Adjacency_Nlist* anl) { Term_list_iterator next_arg(*this); Term_ each_arg; while (each_arg = next_arg()) if (each_arg->alt_reach(v,v_type,anl)) return(TRUE); return (FALSE); } int Term::alt_reach(Vertex* v, char* v_type, Adjacency_Nlist* anl) { Adjacency* this_adj = anl->get_adj(vertex); char* adj_type = this_adj->ns_type(); if (vertex->same_name(v)) if ((!(this_adj->is_alns())) && (!(strcmp(adj_type,v_type)))) return (TRUE); else return (FALSE); if (!(this_adj->is_alns())) return (FALSE); return (((Alternat_ns*)this_adj->get_ns())->alt_reach(v,v_type,anl)); }