else{// if clock and stack both constraints are satisfied
else{// if clock and stack both constraints are satisfied
stateGCPP*rs=newstateGCPP();
stateGCPP*rs=newstateGCPP();
rs->L=L;// left point remain same
rs->L=L;// left point remain same
rs->P=vs->P;// #points in new state
rs->P=vs->P;// #points in new state
rs->del=vs->del;// transitions are same as vs returned in reduce operation
rs->del=vs->del;// transitions are same as vs returned in reduce operation
rs->w=newchar[vs->P];// last tsm value different, so change the whole array of tsm's
rs->w=newchar[vs->P];// last tsm value different, so change the whole array of tsm's
for(j=0;j<(vs->P-1);j++){// tsm values before last point remain same as vs
for(j=0;j<(vs->P-1);j++){// tsm values before last point remain same as vs
rs->w[j]=vs->w[j];
rs->w[j]=vs->w[j];
}
}
rs->w[vs->P-1]=wn;// new tsm value for last point
rs->w[vs->P-1]=wn;// new tsm value for last point
rs->f=(vs->f)&(~a32[vs->P-1]);// flag value comes from vs except for last point
rs->f=(vs->f)&(~a32[vs->P-1]);// flag value comes from vs except for last point
// if distance from the active point just before 'dn'(in new state) to point P(in old state) is accurate, (vs->P) > 1 means that we have taken at least one point from old state
// if distance from the active point just before 'dn'(in new state) to point P(in old state) is accurate, (vs->P) > 1 means that we have taken at least one point from old state
if((vs->P)>1&&((vs->f)&a32[vs->P-1])){
if((vs->P)>1&&((vs->f)&a32[vs->P-1])){
// calculate distance from 2nd last point to last point in new state
// calculate distance from 2nd last point to last point in new state
dis=vs->w[vs->P-1]+mod(wn-w[P-1],M);
dis=vs->w[vs->P-1]+mod(wn-w[P-1],M);
if(dis<M){// reset vs->P-1 bit to 0
if(dis<M){// reset vs->P-1 bit to 0
rs->f|=(a32[vs->P-1]);
rs->f|=(a32[vs->P-1]);
}
}
}
}
v.push_back(rs);// rs will be a reachable state after add operation
v.push_back(rs);// rs will be a reachable state after add operation
}
}
}
}
}
}
}
}
returnv;
returnv;
}
}
// Return template successor state whose descendent states will be right states for shuffle operation with this state
// Return template successor state whose descendent states will be right states for shuffle operation with this state
stateGCPP*stateGCPP::sucState(){
stateGCPP*stateGCPP::sucState(){
shortcurReset,reset;// temp vars for keeping reset bit vector
shortcurReset,reset;// temp vars for keeping reset bit vector
charcount;// will contain #points in the new state
charcount;// will contain #points in the new state
chari,j;// counters
chari,j;// counters
// iterate through all points right to left except the last point
// iterate through all points right to left except the last point
curReset=transitions[del[P-1]].reset;
curReset=transitions[del[P-1]].reset;
count=1;//we have to take the last point, so initialize 'count' to 1
count=1;//we have to take the last point, so initialize 'count' to 1
for(i=P-2;i>=0;i--){
for(i=P-2;i>=0;i--){
reset=transitions[del[i]].reset;// reset bit vector for point i+1
reset=transitions[del[i]].reset;// reset bit vector for point i+1
if(reset&(~curReset)&(~1)){// if (i+1)-th point has additional reset for some clock
if(reset&(~curReset)&(~1)){// if (i+1)-th point has additional reset for some clock
count++;
count++;
curReset|=reset;
curReset|=reset;
}
}
}
}
stateGCPP*vs=newstateGCPP();// new template state
stateGCPP*vs=newstateGCPP();// new template state
vs->P=count;//#points
vs->P=count;//#points
vs->L=count;// no non-trivial block is there
vs->L=count;// no non-trivial block is there
vs->del=newchar[count];
vs->del=newchar[count];
vs->w=newchar[count];
vs->w=newchar[count];
vs->del[count-1]=del[P-1];
vs->del[count-1]=del[P-1];
vs->w[count-1]=w[P-1];
vs->w[count-1]=w[P-1];
// copy the necessary points into the template state
// copy the necessary points into the template state
charlastindex=P-1;
charlastindex=P-1;
shortnf=0;// flag variable for new state
shortnf=0;// flag variable for new state
curReset=transitions[del[P-1]].reset;
curReset=transitions[del[P-1]].reset;
for(i=P-2,j=count-2;i>=0;i--){
for(i=P-2,j=count-2;i>=0;i--){
reset=transitions[del[i]].reset;// reset bit vector for point i+1
reset=transitions[del[i]].reset;// reset bit vector for point i+1
if(reset&(~curReset)&(~1)){// found a new necessary point, copy this point to new state
if(reset&(~curReset)&(~1)){// found a new necessary point, copy this point to new state
vs->del[j]=del[i];
vs->del[j]=del[i];
vs->w[j]=w[i];
vs->w[j]=w[i];
if(!big(i+1,lastindex+1))//from current needy point to the last found needy point distance small
if(!big(i+1,lastindex+1))//from current needy point to the last found needy point distance small
nf|=a32[j+1];// distance (j+1->(j+2)) is small
nf|=a32[j+1];// distance (j+1->(j+2)) is small
curReset|=reset;
curReset|=reset;
j--;
j--;
lastindex=i;// this point is the last point selected till now
lastindex=i;// this point is the last point selected till now
}
}
}
}
vs->f=nf;// copy flag information, no stack info is there till now for the template state
vs->f=nf;// copy flag information, no stack info is there till now for the template state
returnvs;
returnvs;
}
}
// print a validity state
// print a validity state
voidstateGCPP::print(){
voidstateGCPP::print(){
chari;
chari;
cout<<endl<<"Abstract state of the on the fly tree automata(TA):"<<endl;
cout<<endl<<"Abstract state of the on the fly tree automata(TA):"<<endl;
cout<<"\tPoints in the automaton:\n\t\t";
cout<<"\tPoints in the automaton:\n\t\t";
cout<<1;
cout<<1;
for(i=2;i<=L;i++)
for(i=2;i<=L;i++)
cout<<" "<<int(i);
cout<<" "<<int(i);
for(i=L+1;i<=P;i++)
for(i=L+1;i<=P;i++)
cout<<"----"<<int(i);
cout<<"----"<<int(i);
cout<<endl;
cout<<endl;
cout<<"\t\tL : "<<int(L)<<endl;
cout<<"\t\tL : "<<int(L)<<endl;
cout<<"\tTransitions:";
cout<<"\tTransitions:";
cout<<"\t";
cout<<"\t";
for(i=0;i<P;i++)
for(i=0;i<P;i++)
cout<<int(del[i])<<"\t";
cout<<int(del[i])<<"\t";
cout<<endl;
cout<<endl;
cout<<"\tAccuracy: "<<"\t ";
cout<<"\tAccuracy: "<<"\t ";
for(i=1;i<P;i++){
for(i=1;i<P;i++){
cout<<((a32[i]&f)?1:0)<<"\t ";
cout<<((a32[i]&f)?1:0)<<"\t ";
}
}
cout<<endl;
cout<<endl;
cout<<"\tTSM : \t";
cout<<"\tTSM : \t";
cout<<"\t";
cout<<"\t";
for(i=0;i<P;i++)
for(i=0;i<P;i++)
cout<<int(w[i])<<"\t";
cout<<int(w[i])<<"\t";
cout<<endl;
cout<<endl;
cout<<endl<<endl;
cout<<endl<<endl;
cout<<"\tPush done at L : "<<((f&1)?1:0)<<endl;
cout<<"\tPush done at L : "<<((f&1)?1:0)<<endl;
cout<<"\tPop done at R : "<<((f&a3215)?1:0)<<endl;
cout<<"\tPop done at R : "<<((f&a3215)?1:0)<<endl;
// transition at first point must be 0-th transition
// transition at first point must be 0-th transition
if(del[0]!=0)
if(del[0]!=0)
returnfalse;
returnfalse;
// there will not any push at the last transition
// there will not any push at the last transition
if(isPush(del[P-1]))
if(isPush(del[P-1]))
returnfalse;
returnfalse;
// target state of the transiton at point R should be the final state
// target state of the transiton at point R should be the final state
if(transitions[del[P-1]].target!=SF)
if(transitions[del[P-1]].target!=SF)
returnfalse;
returnfalse;
returntrue;
returntrue;
}
}
// return the partial run corresponding the tree automata state 'vs', ignore the hanging points
// return the partial run corresponding the tree automata state 'vs', ignore the hanging points
// copy only transitions between L(left) and R(right)
// copy only transitions between L(left) and R(right)
runCGPP*getRun(stateGCPP*vs){
runCGPP*getRun(stateGCPP*vs){
runCGPP*pr=newrunCGPP();// new partial run stored in variable pr
runCGPP*pr=newrunCGPP();// new partial run stored in variable pr
pr->P=vs->P-vs->L+1;// transitions in new partial run will be from left(L) point to right(R) point
pr->P=vs->P-vs->L+1;// transitions in new partial run will be from left(L) point to right(R) point
// allocate memory for transitions and tsm vlaues for new run
// allocate memory for transitions and tsm vlaues for new run
pr->del=newchar[pr->P];
pr->del=newchar[pr->P];
pr->w=newchar[pr->P];
pr->w=newchar[pr->P];
// loopers : i used to index transition of the tree automata state and j is used to index trans in the run
// loopers : i used to index transition of the tree automata state and j is used to index trans in the run
chari=vs->L-1,j=0;
chari=vs->L-1,j=0;
// copy transitions and tsm values from earlier partial run to new partial run
// copy transitions and tsm values from earlier partial run to new partial run
for(;i<(vs->P);i++,j++){
for(;i<(vs->P);i++,j++){
pr->del[j]=vs->del[i];
pr->del[j]=vs->del[i];
pr->w[j]=vs->w[i];
pr->w[j]=vs->w[i];
}
}
returnpr;// return the new run
returnpr;// return the new run
}
}
// GIVEN the current partial run, append the transition 'dn' with tsm value 'wn'
// GIVEN the current partial run, append the transition 'dn' with tsm value 'wn'
runCGPP*runCGPP::addNext(chardn,charwn){
runCGPP*runCGPP::addNext(chardn,charwn){
runCGPP*pr=newrunCGPP();// new partial run stored in variable pr
runCGPP*pr=newrunCGPP();// new partial run stored in variable pr
pr->P=P+1;// #transitions in new partial run will be one more than the earlier
pr->P=P+1;// #transitions in new partial run will be one more than the earlier
// allocate memory for transitions and tsm vlaues for new run
// allocate memory for transitions and tsm vlaues for new run
pr->del=newchar[pr->P];
pr->del=newchar[pr->P];
pr->w=newchar[pr->P];
pr->w=newchar[pr->P];
// copy transitions and tsm values from earlier partial run to new partial run
// copy transitions and tsm values from earlier partial run to new partial run
for(chari=0;i<P;i++){
for(chari=0;i<P;i++){
pr->del[i]=del[i];
pr->del[i]=del[i];
pr->w[i]=w[i];
pr->w[i]=w[i];
}
}
pr->del[P]=dn;// add the new transition and tsm value to the last position of new partial run
pr->del[P]=dn;// add the new transition and tsm value to the last position of new partial run
pr->w[P]=wn;
pr->w[P]=wn;
returnpr;// return the new run
returnpr;// return the new run
}
}
// shuffle two partial runs and return the new partial run
// shuffle two partial runs and return the new partial run
runCGPP*runCGPP::shuffle(runCGPP*s2){
runCGPP*runCGPP::shuffle(runCGPP*s2){
runCGPP*pr=newrunCGPP();// new partial run stored in variable pr
runCGPP*pr=newrunCGPP();// new partial run stored in variable pr
/* rightmost transition of left state is equal to leftmost transition of right state
/* rightmost transition of left state is equal to leftmost transition of right state
so new run will be concatenation of two runs and #points in new run is calculated as below*/
so new run will be concatenation of two runs and #points in new run is calculated as below*/
pr->P=P+(s2->P)-1;
pr->P=P+(s2->P)-1;
// allocate memory for transitions and tsm vlaues for new run
// allocate memory for transitions and tsm vlaues for new run
pr->del=newchar[pr->P];
pr->del=newchar[pr->P];
pr->w=newchar[pr->P];
pr->w=newchar[pr->P];
chari,j;// loopers
chari,j;// loopers
// copy the transitions and tsm values of first run except for the last position
// copy the transitions and tsm values of first run except for the last position
for(i=0,j=0;i<(P-1);i++,j++){
for(i=0,j=0;i<(P-1);i++,j++){
pr->w[j]=w[i];
pr->w[j]=w[i];
pr->del[j]=del[i];
pr->del[j]=del[i];
}
}
// copy the transitions and tsm values of 2nd run
// copy the transitions and tsm values of 2nd run
for(i=0;i<(s2->P);i++,j++){
for(i=0;i<(s2->P);i++,j++){
pr->w[j]=s2->w[i];
pr->w[j]=s2->w[i];
pr->del[j]=s2->del[i];
pr->del[j]=s2->del[i];
}
}
returnpr;// return the new run
returnpr;// return the new run
}
}
// this will return a state with only 0-th transition with tsm value 0
// this will return a state with only 0-th transition with tsm value 0
stateGCPP*getZeroState(){
stateGCPP*getZeroState(){
stateGCPP*vs=newstateGCPP();
stateGCPP*vs=newstateGCPP();
vs->L=1;// only one point is there
vs->L=1;// only one point is there
vs->P=1;
vs->P=1;
vs->f=0;// no push pop info yet, no accuracy info yet
vs->f=0;// no push pop info yet, no accuracy info yet
vs->del=newchar[1];// memory allocation
vs->del=newchar[1];// memory allocation
vs->w=newchar[1];
vs->w=newchar[1];
vs->del[0]=0;// 0th transition has tsm value 0
vs->del[0]=0;// 0th transition has tsm value 0
vs->w[0]=0;
vs->w[0]=0;
returnvs;
returnvs;
}
}
// return unique string for last reset points of current state participating in a combine operation as a left state
// return unique string for last reset points of current state participating in a combine operation as a left state
stringstateGCPP::getKeyLeft(){
stringstateGCPP::getKeyLeft(){
strings="";// return this string
strings="";// return this string
shortresetSoFar,reset;// used for calculating union of resets
shortresetSoFar,reset;// used for calculating union of resets
s+=del[P-1];// include rightmost transition in the string
s+=del[P-1];// include rightmost transition in the string
s+=w[P-1];// tsm value also be part of the key
s+=w[P-1];// tsm value also be part of the key
charlastindex=P-1;// last index we have taken
charlastindex=P-1;// last index we have taken
charnf=0;// distance info
charnf=0;// distance info
chari=P-2;
chari=P-2;
charj=0;
charj=0;
resetSoFar=transitions[del[P-1]].reset;// set of clocks reset at rightmost point
resetSoFar=transitions[del[P-1]].reset;// set of clocks reset at rightmost point
for(;i>=0;i--){
for(;i>=0;i--){
reset=transitions[del[i]].reset;// take (i+1)-th point transition reset set
reset=transitions[del[i]].reset;// take (i+1)-th point transition reset set
if(reset&(~resetSoFar)&(~1)){// if there are some new clocks reset at point (i+1)
if(reset&(~resetSoFar)&(~1)){// if there are some new clocks reset at point (i+1)
s+=del[i];
s+=del[i];
s+=w[i];
s+=w[i];
resetSoFar|=reset;
resetSoFar|=reset;
if(!big(i+1,lastindex+1))
if(!big(i+1,lastindex+1))
nf|=a32[j];
nf|=a32[j];
j++;
j++;
}
}
}
}
s+=nf;
s+=nf;
returns;// return the key
returns;// return the key
}
}
// return unique string for hanging points of a state participating in a combine operation as a right state
// return unique string for hanging points of a state participating in a combine operation as a right state
stringstateGCPP::getKeyRight(){
stringstateGCPP::getKeyRight(){
strings="";// return this string as a key for current state
strings="";// return this string as a key for current state
// take the transition at point L and all hanging points
// take the transition at point L and all hanging points
charnf=0;// this contains distance information between points
charnf=0;// this contains distance information between points
s+=del[L-1];// L-th poiint transition
s+=del[L-1];// L-th poiint transition
s+=w[L-1];// L-th point tsm
s+=w[L-1];// L-th point tsm
charj=0;// used for distance counter
charj=0;// used for distance counter
chari=L-2;// counter for points from right to left starting from L-1 point
chari=L-2;// counter for points from right to left starting from L-1 point
for(;i>=0;i--,j++){
for(;i>=0;i--,j++){
s+=del[i];
s+=del[i];
s+=w[i];
s+=w[i];
if(f&a32[i+1])
if(f&a32[i+1])
nf|=a32[j];
nf|=a32[j];
}
}
// add distance info in the key
// add distance info in the key
s+=nf;
s+=nf;
returns;
returns;
}
}
// print a run as witness of the given TPDA if the language is non-empty
// print a run as witness of the given TPDA if the language is non-empty
voidrunCGPP::print(){
voidrunCGPP::print(){
shortintlt=0,ct=0;// lt : last timestamps, ct : current time stamps
shortintlt=0,ct=0;// lt : last timestamps, ct : current time stamps
cout<<endl<<"A run of the automation as a witness for the language to be non-empty.\nThe run given as a sequence of pairs (Transition, Time stamp) : "<<endl;
cout<<endl<<"A run of the automation as a witness for the language to be non-empty.\nThe run given as a sequence of pairs (Transition, Time stamp) : "<<endl;
for(chari=0;i<P;i++){
for(chari=0;i<P;i++){
if(w[i]<lt)// if current time stamps less than last time stamps
// transition at first point must be 0-th transition
// transition at first point must be 0-th transition
if(del[0]!=0)
if(del[0]!=0)
returnfalse;
returnfalse;
// there will not any push at the last transition
// there will not any push at the last transition
if(isPush(del[P-1]))
if(isPush(del[P-1]))
returnfalse;
returnfalse;
// target state of the transiton at point R should be the final state
// target state of the transiton at point R should be the final state
if(transitions[del[P-1]].target!=SF)
if(transitions[del[P-1]].target!=SF)
returnfalse;
returnfalse;
returntrue;
returntrue;
}
}
/*
/*
// return the partial run corresponding the tree automata state 'vs', ignore the hanging points
// return the partial run corresponding the tree automata state 'vs', ignore the hanging points
// copy only transitions between L(left) and R(right)
// copy only transitions between L(left) and R(right)
runCGPP* getRun(stateGCPP* vs) {
runCGPP* getRun(stateGCPP* vs) {
runCGPP *pr = new runCGPP(); // new partial run stored in variable pr
runCGPP *pr = new runCGPP(); // new partial run stored in variable pr
pr->P = vs->P - vs->L + 1 ; // transitions in new partial run will be from left(L) point to right(R) point
pr->P = vs->P - vs->L + 1 ; // transitions in new partial run will be from left(L) point to right(R) point
// allocate memory for transitions and tsm vlaues for new run
// allocate memory for transitions and tsm vlaues for new run
pr->del = new char[pr->P];
pr->del = new char[pr->P];
pr->w = new char[pr->P];
pr->w = new char[pr->P];
// loopers : i used to index transition of the tree automata state and j is used to index trans in the run
// loopers : i used to index transition of the tree automata state and j is used to index trans in the run
char i = vs->L - 1, j=0;
char i = vs->L - 1, j=0;
// copy transitions and tsm values from earlier partial run to new partial run
// copy transitions and tsm values from earlier partial run to new partial run
for(; i < (vs->P); i++, j++) {
for(; i < (vs->P); i++, j++) {
pr->del[j] = vs->del[i];
pr->del[j] = vs->del[i];
pr->w[j] = vs->w[i];
pr->w[j] = vs->w[i];
}
}
return pr; // return the new run
return pr; // return the new run
}
}
// GIVEN the current partial run, append the transition 'dn' with tsm value 'wn'
// GIVEN the current partial run, append the transition 'dn' with tsm value 'wn'
runCGPP* runCGPP::addNext(char dn, char wn) {
runCGPP* runCGPP::addNext(char dn, char wn) {
runCGPP *pr = new runCGPP(); // new partial run stored in variable pr
runCGPP *pr = new runCGPP(); // new partial run stored in variable pr
pr->P = P + 1; // #transitions in new partial run will be one more than the earlier
pr->P = P + 1; // #transitions in new partial run will be one more than the earlier
// allocate memory for transitions and tsm vlaues for new run
// allocate memory for transitions and tsm vlaues for new run
pr->del = new char[pr->P];
pr->del = new char[pr->P];
pr->w = new char[pr->P];
pr->w = new char[pr->P];
// copy transitions and tsm values from earlier partial run to new partial run
// copy transitions and tsm values from earlier partial run to new partial run
for(char i=0; i < P; i++) {
for(char i=0; i < P; i++) {
pr->del[i] = del[i];
pr->del[i] = del[i];
pr->w[i] = w[i];
pr->w[i] = w[i];
}
}
pr->del[P] = dn; // add the new transition and tsm value to the last position of new partial run
pr->del[P] = dn; // add the new transition and tsm value to the last position of new partial run
pr->w[P] = wn;
pr->w[P] = wn;
return pr; // return the new run
return pr; // return the new run
}
}
// shuffle two partial runs and return the new partial run
// shuffle two partial runs and return the new partial run
runCGPP* runCGPP::shuffle(runCGPP *s2) {
runCGPP* runCGPP::shuffle(runCGPP *s2) {
runCGPP *pr = new runCGPP(); // new partial run stored in variable pr
runCGPP *pr = new runCGPP(); // new partial run stored in variable pr
// rightmost transition of left state is equal to leftmost transition of right state
// rightmost transition of left state is equal to leftmost transition of right state
so new run will be concatenation of two runs and #points in new run is calculated as below//
so new run will be concatenation of two runs and #points in new run is calculated as below//
pr->P = P + (s2->P) - 1;
pr->P = P + (s2->P) - 1;
// allocate memory for transitions and tsm vlaues for new run
// allocate memory for transitions and tsm vlaues for new run
pr->del = new char[pr->P];
pr->del = new char[pr->P];
pr->w = new char[pr->P];
pr->w = new char[pr->P];
char i, j; // loopers
char i, j; // loopers
// copy the transitions and tsm values of first run except for the last position
// copy the transitions and tsm values of first run except for the last position
for(i=0, j=0; i < (P-1); i++, j++) {
for(i=0, j=0; i < (P-1); i++, j++) {
pr->w[j] = w[i];
pr->w[j] = w[i];
pr->del[j] = del[i];
pr->del[j] = del[i];
}
}
// copy the transitions and tsm values of 2nd run
// copy the transitions and tsm values of 2nd run
for(i=0; i < (s2->P); i++, j++) {
for(i=0; i < (s2->P); i++, j++) {
pr->w[j] = s2->w[i];
pr->w[j] = s2->w[i];
pr->del[j] = s2->del[i];
pr->del[j] = s2->del[i];
}
}
return pr; // return the new run
return pr; // return the new run
}
}
*/
*/
// this will return a state with only 0-th transition with tsm value 0
// this will return a state with only 0-th transition with tsm value 0
stateZone*getZeroStateZone(){
stateZone*getZeroStateZone(){
stateZone*vs=newstateZone();//initialize a stateZone object
stateZone*vs=newstateZone();//initialize a stateZone object
vs->P=1;//the first point
vs->P=1;//the first point
vs->f=1;// no push pop info yet and L = 1 cause the last bit of the flag denotes the push complete information
vs->f=1;// no push pop info yet and L = 1 cause the last bit of the flag denotes the push complete information
vs->del=newchar[1];// memory allocation for the transitions
vs->del=newchar[1];// memory allocation for the transitions
vs->w=NULL;//the 2-dimentional array projected in to one dimentional arry initially empty
vs->w=NULL;//the 2-dimentional array projected in to one dimentional arry initially empty
vs->del[0]=0;// 0th transition has tsm value 0
vs->del[0]=0;// 0th transition has tsm value 0
returnvs;
returnvs;
}
}
// return unique string for last reset points of current state participating in a combine operation as a left state
// return unique string for last reset points of current state participating in a combine operation as a left state
stringstateZone::getKeyLeft(){
stringstateZone::getKeyLeft(){
strings="";// return this string
strings="";// return this string
shortresetSoFar,reset;// used for calculating union of resets
shortresetSoFar,reset;// used for calculating union of resets
s+=del[P-1];// include rightmost transition in the string
s+=del[P-1];// include rightmost transition in the string
//sparsa's editing
//s += w[P-1]; // tsm value also be part of the key in zone we dont have any tsm values
charlastindex=P-1;// last index we have taken
//char nf = 0; // distance info DO we need it??
chari=P-2;//list
charj=0;
resetSoFar=transitions[del[P-1]].reset;// set of clocks reset at rightmost point
for(;i>=0;i--){
reset=transitions[del[i]].reset;// take (i+1)-th point transition reset set
//sparsa's editing
if(reset&(~resetSoFar)&(~1)){// if there are some new clocks reset at point (i+1)
//s += w[P-1]; // tsm value also be part of the key in zone we dont have any tsm values
s+=del[i];//then add the transition to the string
charlastindex=P-1;// last index we have taken
//s += w[i]; // but we dont have
resetSoFar|=reset;
//char nf = 0; // distance info DO we need it??
//if( !big(i+1, lastindex+1) )
chari=P-2;//list
// nf |= a32[j];
charj=0;
j++;
}
resetSoFar=transitions[del[P-1]].reset;// set of clocks reset at rightmost point
}
for(;i>=0;i--){
//s += nf;
reset=transitions[del[i]].reset;// take (i+1)-th point transition reset set
returns;// return the key
if(reset&(~resetSoFar)&(~1)){// if there are some new clocks reset at point (i+1)
s+=del[i];//then add the transition to the string
//s += w[i]; // but we dont have
resetSoFar|=reset;
//if( !big(i+1, lastindex+1) )
// nf |= a32[j];
j++;
}
}
//s += nf;
returns;// return the key
}
}
// return unique string for hanging points of a state participating in a combine operation as a right state
// return unique string for hanging points of a state participating in a combine operation as a right state
stringstateZone::getKeyRight(){
stringstateZone::getKeyRight(){
strings="";// return this string as a key for current state
strings="";// return this string as a key for current state
// take the transition at point L and all hanging points
// take the transition at point L and all hanging points
//char nf = 0; // this contains distance information between points distance information not needed
//char nf = 0; // this contains distance information between points distance information not needed
s+=del[(f&127)-1];// L-th poiint transition
s+=del[(f&127)-1];// L-th poiint transition
//s+= w[L-1]; // L-th point tsm dont need in Zone
//s+= w[L-1]; // L-th point tsm dont need in Zone
//char j = 0; // used for distance counter no distance in zone
//char j = 0; // used for distance counter no distance in zone
chari=(f&127)-2;// counter for points from right to left starting from L-1 point
chari=(f&127)-2;// counter for points from right to left starting from L-1 point
for(;i>=0;i--,j++){
for(;i>=0;i--)//j++)
s+=del[i];
{
//s += w[i]; not needed in zone cause for zone it is not a time stamp
s+=del[i];
//s += w[i]; not needed in zone cause for zone it is not a time stamp
//if(f & a32[i+1] )
//nf |= a32[j];
//if(f & a32[i+1] )
}
//nf |= a32[j];
}
// add distance info in the key
//s+= nf;
// add distance info in the key
//s+= nf;
returns;
returns;
}
}
/*
/*
// print a run as witness of the given TPDA if the language is non-empty
// print a run as witness of the given TPDA if the language is non-empty
void runCGPP::print() {
void runCGPP::print() {
short int lt = 0, ct=0; // lt : last timestamps, ct : current time stamps
short int lt = 0, ct=0; // lt : last timestamps, ct : current time stamps
cout << endl << "A run of the automation as a witness for the language to be non-empty.\nThe run given as a sequence of pairs (Transition, Time stamp) : " << endl;
cout << endl << "A run of the automation as a witness for the language to be non-empty.\nThe run given as a sequence of pairs (Transition, Time stamp) : " << endl;
for(char i=0; i < P; i++) {
for(char i=0; i < P; i++) {
if( w[i] < lt ) // if current time stamps less than last time stamps
if( w[i] < lt ) // if current time stamps less than last time stamps