CFG *Add_target(CFG *cfg,int target,string checkstr){ check = trim(checkstr); CFG *cfg1=new CFG(); cfg1=cfg; int len=check.length(); char x[len]; int numCheck=1;//count of equations for(int i=0;i<len;i++){ x[i]=check.at(i); if(x[i]=='&') numCheck++; } State *old_target=cfg->searchState(target); string funcName = old_target->funcName; State *new_target=new State(false,-1,"q1",funcName); new_target->transList.clear(); new_target->consList.clear(); Transition *temp=new Transition(-2,"p1"); temp->fromState=old_target; temp->fromName=cfg->getNodeName(target); temp->level=temp->fromState->level+1; temp->toState=new_target; new_target->level = temp->level; temp->toName="q1"; temp->guardList.clear(); int a[numCheck+1]; int k=0; a[k++]=0; for(int i=0;i<len;i++) if(x[i]=='&') a[k++]=i+1; a[numCheck]=len+1; string b[numCheck]; for(int i=0;i<numCheck;i++) b[i]=check.substr(a[i],a[i+1]-a[i]-1); Constraint cTemp; for(int i=0;i<numCheck;i++){ cTemp = StringToConstraints(b[i], funcName); temp->guardList.push_back(cTemp); } cfg1->stateList.push_back(*new_target); cfg1->transitionList.push_back(*temp); return cfg1; }