/// /////Displays the relationship info of the types displayed during the first parse///////////////// public void complete(List <relationelem> list_relations) { Repository_types rep = Repository_types.getInstance(); Console.WriteLine("\n \n The relationships between the types above are as follows\n"); foreach (relationelem e in list_relations) { if (e.isInheritance == true) { Console.WriteLine("\n {0} is inheriting from {1}", e.b_class, e.a_class); } } foreach (relationelem e in list_relations) { if (e.isAggregation == true) { Console.Write("\n {0} is aggregating {1}", e.a_class, e.b_class); } } foreach (relationelem e in list_relations) { if (e.isComposition == true) { Console.Write("\n {0} Composition {1}", e.a_class, e.b_class); } } }
public override void doAction(CSsemi.CSemiExp semi) { Repository_types reporel_ = Repository_types.getInstance(); //************************checks for inheritance*********************** if (semi.Contains("inheritance") != -1) { int loc = semi.Contains("inheritance"); if (loc != -1) { Elem e = new Elem(); e.type = semi[loc + 3]; e.name = semi[loc + 1]; repo_.stack.push(e); relationelem r_elem = new relationelem(); r_elem.a_class = semi[loc + 1].ToString(); r_elem.b_class = semi[loc + 2].ToString(); r_elem.isInheritance = true; repo_.classrelations.Add(r_elem); } } //**************************** check for aggregation**************// if (semi.Contains("aggregation") != -1) { int loc = semi.Contains("aggregation"); if (loc != -1) { Elem e = new Elem(); e.type = semi[loc + 2]; e.name = semi[loc + 1]; repo_.stack.push(e); int i = rep.locations.Count; Elem temp = rep.locations[i - 1]; if (semi[1] != temp.name) { relationelem r_elem = new relationelem(); r_elem.a_class = temp.name; r_elem.b_class = semi[1].ToString(); r_elem.isAggregation = true; repo_.classrelations.Add(r_elem); } } } if (AAction.displaySemi) { //Console.Write("\n line# {0,-5}", repo_.semi.lineCount - 1); //Console.Write("entering "); //string indent = new string(' ', 2 * repo_.stack.count); //Console.Write("{0}", indent); //this.display(semi); // defined in abstract action } if (AAction.displayStack) { repo_.stack.display(); } }
//*****second parse************// public void reldoAnalysis(string[] files) { foreach (object file in files) { Console.Write("\n Processing file {0}\n", file as string); CSsemi.CSemiExp semi = new CSsemi.CSemiExp(); semi.displayNewLines = false; if (!semi.open(file as string)) { Console.Write("\n Can't open {0}\n\n", file); return; } Repository rep_inst = Repository.getInstance(); Repository.Copy_buffer = typesBetweenFiles; BuildCodeAnalyzer_types builder_ty = new BuildCodeAnalyzer_types(semi); Parser parser = builder_ty.build(); // sends every semi again for relationship analysis try { while (semi.getSemi()) { parser.parse(semi); } } catch (Exception ex) { Console.Write("\n\n {0}\n", ex.Message); } //stores all the updation to the type and relationship list back to the repository Repository_types rep = Repository_types.getInstance(); List <relationelem> table = rep.classrelations; rel_BetweenFiles = (rep.classrelations); } }
public Print(Repository_types repo) { repo_ = repo; }
public PushStack_rel(Repository_types repo) { repo_ = repo; }
List <relationelem> classrelations_ = new List <relationelem>(); //holds all the relationship info public Repository_types() { instance = this; }