Changeset 7c81165 in git for kernel/f5lists.cc
- Timestamp:
- Mar 12, 2009, 10:43:53 AM (14 years ago)
- Branches:
- (u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', 'a800fe4b3e9d37a38c5a10cc0ae9dfa0c15a4ee6')
- Children:
- 75e2e50e5ba0dbb6681ecbf8664330997a24b5e9
- Parents:
- 47ca23dae2b0131537f61842055e75beb7836f77
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/f5lists.cc
r47ca23 r7c81165 489 489 // working only with linked, but not doubly linked lists due to memory usage we have to check the 490 490 // insertion around the first element separately from the insertion around all other elements in the list 491 CNode* CNode::insert(CPair* c , CNode* last) {492 if(NULL == this ->data) {491 CNode* CNode::insert(CPair* c) { 492 if(NULL == this) { 493 493 CNode* newElement = new CNode(c, this); 494 494 return newElement; … … 511 511 //Print("Insert Deg\n"); 512 512 CNode* temp = this; 513 while( NULL != temp->next ->data) {513 while( NULL != temp->next) { 514 514 if(temp->next->data->getDeg() == c->getDeg() ) { 515 515 if(1 == pLmCmp(u1,ppMult_qq(temp->next->data->getT1(),temp->next->data->getLp1Term()))) { … … 528 528 } 529 529 } 530 CNode* newElement = new CNode(c, last);530 CNode* newElement = new CNode(c, NULL); 531 531 temp->next = newElement; 532 532 return this; … … 535 535 if( c->getDeg() > this->data->getDeg() ) { // greater degree than the first list element 536 536 CNode* temp = this; 537 while( NULL != temp->next ->data) {537 while( NULL != temp->next ) { 538 538 if( c->getDeg() < temp->next->data->getDeg() ) { 539 539 CNode* newElement = new CNode(c, temp->next); … … 549 549 else { 550 550 temp = temp->next; 551 while( NULL != temp->next ->data) {551 while( NULL != temp->next ) { 552 552 if( temp->next->data->getDeg() == c->getDeg() ) { 553 553 if(1 == pLmCmp(u1,ppMult_qq(temp->next->data->getT1(), … … 567 567 } 568 568 } 569 CNode* newElement = new CNode(c, last);569 CNode* newElement = new CNode(c, NULL); 570 570 temp->next = newElement; 571 571 return this; … … 576 576 } 577 577 } 578 CNode* newElement = new CNode(c, last);578 CNode* newElement = new CNode(c, NULL); 579 579 temp->next = newElement; 580 580 return this; … … 586 586 CNode* CNode::getMinDeg() { 587 587 CNode* temp = this; 588 while( NULL != temp->data) {589 while(NULL != temp->next ->data&& temp->next->data->getDeg() == this->data->getDeg()) {588 while(NULL != temp) { 589 while(NULL != temp->next && temp->next->data->getDeg() == this->data->getDeg()) { 590 590 temp = temp->next; 591 591 } … … 593 593 // every CList should end with a (NULL,NULL) element for a similar behaviour 594 594 // using termination conditions throughout the algorithm 595 temp->next = new CNode();595 temp->next = NULL; 596 596 return returnCNode; 597 597 } … … 663 663 CNode* temp = this; 664 664 Print("___________________List of critical pairs______________________:\n"); 665 while(NULL != temp ->data) {665 while(NULL != temp) { 666 666 Print("LP1 Index: %d\n",temp->getLp1Index()); 667 667 Print("T1: "); … … 690 690 // for initialization of CLists, last element alwas has data=NULL and next=NULL 691 691 CList::CList() { 692 first = new CNode(); 693 last = first; 692 first = NULL; 694 693 } 695 694 696 695 CList::CList(CPair* c) { 697 696 first = new CNode(c); 698 last = first;699 697 } 700 698 701 699 CList::~CList() { 702 700 CNode* temp; 703 while( first) {701 while(NULL != first) { 704 702 temp = first; 705 703 first = first->getNext(); … … 711 709 // note: as all critical pairs have the same index here, the second sort is done on the terms of the labels 712 710 void CList::insert(CPair* c) { 713 first = first->insert(c , last);711 first = first->insert(c); 714 712 } 715 713
Note: See TracChangeset
for help on using the changeset viewer.