public override bool test(CSsemi.CSemiExp semi) { Repository repo_ = Repository.getInstance(); int index = semi.Contains("("); int endindex = semi.Contains(")"); int loopindex = semi.FindAll(","); int currindex = 0; bool flag = false; if (index != -1 && !isSpecialToken(semi[index - 1])) { string currclassName = FindParentClass.getClassName(repo_.semi.lineCount); currindex = index; string functionname = semi[currindex - 1]; for (int i = 0; i <= loopindex; i++) { CSsemi.CSemiExp local = new CSsemi.CSemiExp(); local.displayNewLines = false; local.Add(currclassName).Add(functionname).Add(semi[currindex + 1]).Add(semi[currindex + 2]); doActionsForUsing(local); flag = true; currindex = index + 3; } } if (flag) { return(true); } return(false); }
/*Checks whether the input semi expression contains composition relationship * If it is present then the action method for composition is called */ public override bool test(CSsemi.CSemiExp semi) { List <string> variablecountlist = null; Repository repo_ = Repository.getInstance(); if (semi.count >= 2) { variablecountlist = semi.DetectVariables(); } if (variablecountlist != null && variablecountlist.Count == 2) { string currclassName = FindParentClass.getClassName(repo_.semi.lineCount); CSsemi.CSemiExp local = new CSsemi.CSemiExp(); local.displayNewLines = false; local.Add(variablecountlist[0]).Add(variablecountlist[1]).Add(currclassName); doActionsForComposition(local); return(true); } return(false); }
/*Checks whether the input semi expression contains aggregation relationship * If it is present then the action method for aggregation is called */ public override bool test(CSsemi.CSemiExp semi) { Repository repo_ = Repository.getInstance(); int index = semi.FindFirst("new"); if (index != -1) { string currclassName = FindParentClass.getClassName(repo_.semi.lineCount); //if (currclassName.CompareTo("") == 0) //{ // return true; //} CSsemi.CSemiExp local = new CSsemi.CSemiExp(); // local semiExp with tokens for type and name local.displayNewLines = false; local.Add(semi[index + 1]).Add(semi[index - 2]).Add(currclassName); doActionsForAggregation(local); return(true); } return(false); }