void Node::GetSwapsList(List **list) { if(Nog || Bot) { *list=new List; (**list).length=0; } else if((LeftC->Bot || LeftC->Nog) && (RightC->Bot || RightC->Nog)) { *list=new List; (*list)->length=0; AddCellToEnd(*list,(void *)this); } else { List *llist,*rlist; LeftC->GetSwapsList(&llist); RightC->GetSwapsList(&rlist); CombineLists(llist,rlist,list); AddCellToEnd(*list,(void *)this); } }
void Node::GetNotBotList(List **list) // gets list of pointers to nog nodes { if(Bot) { *list=new List; (**list).length=0; } else if(Nog) { *list=new List; (*list)->length=0; AddCellToEnd(*list,(void *)this); } else { List *llist,*rlist; LeftC->GetNotBotList(&llist); RightC->GetNotBotList(&rlist); CombineLists(llist,rlist,list); AddCellToEnd(*list,(void *)this); } }
void AddCellAfter(List *list,Cell *oldcell,void *p) { if(oldcell->End) { AddCellToEnd(list,p); } else { Cell *cell; cell = new Cell; cell->contents = p; cell->Beg=0; cell->End=0; cell->before = oldcell; cell->after = oldcell->after; oldcell->after = cell; (cell->after)->before = cell; list->length +=1; } }