Changeset 9bb97e in git for kernel/f5lists.cc
- Timestamp:
- Feb 6, 2009, 9:12:35 PM (14 years ago)
- Branches:
- (u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', 'a800fe4b3e9d37a38c5a10cc0ae9dfa0c15a4ee6')
- Children:
- fcb80223d452f79f3b3e1a62b71d291a5fc64943
- Parents:
- b3e45f80f34104e744829011d4460dcee8e1e365
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/f5lists.cc
rb3e45f r9bb97e 26 26 27 27 // generating new list elements (labeled / classical polynomial / LNode view) 28 LNode::LNode(LPoly* lp) { 28 LNode::LNode() { 29 data = NULL; 30 next = NULL; 31 } 32 LNode::LNode(LPoly* lp) { 29 33 data = lp; 30 34 next = NULL; … … 35 39 next = l; 36 40 } 37 LNode::LNode(poly * t, int* i, poly*p) {41 LNode::LNode(poly t, int i, poly p) { 38 42 LPoly* lp = new LPoly(t,i,p); 39 43 data = lp; … … 41 45 } 42 46 43 LNode::LNode(poly * t, int* i, poly*p, LNode* l) {47 LNode::LNode(poly t, int i, poly p, LNode* l) { 44 48 LPoly* lp = new LPoly(t,i,p); 45 49 data = lp; … … 63 67 } 64 68 65 LNode* LNode::insert(poly * t, int* i, poly*p) {69 LNode* LNode::insert(poly t, int i, poly p) { 66 70 LNode* newElement = new LNode(t, i, p, this); 67 71 return newElement; … … 70 74 // insert new elemets to the list w.r.t. increasing labels 71 75 // only used for the S-polys to be reduced (TopReduction building new S-polys with higher label) 72 LNode* LNode::insertByLabel( LPoly* lp) {73 if( lp->getTerm() <= this->data->getTerm()) {74 LNode* newElement = new LNode( lp, this);76 LNode* LNode::insertByLabel(poly t, int i, poly p) { 77 if(0 == pLmCmp(t,this->getTerm()) || -1 == pLmCmp(t,this->getTerm())) { 78 LNode* newElement = new LNode(t, i, p, this); 75 79 return newElement; 76 80 } 77 81 else { 78 82 LNode* temp = this; 79 while( NULL != temp->next ) {80 if( lp->getTerm() <= temp->next->data->getTerm()) {81 LNode* newElement = new LNode( lp, temp->next);83 while( NULL != temp->next->data ) { 84 if( 0 == pLmCmp(t,temp->next->getTerm()) || -1 == pLmCmp(t,temp->next->getTerm())) { 85 LNode* newElement = new LNode(t, i, p, temp->next); 82 86 temp->next = newElement; 83 87 return this; … … 87 91 } 88 92 } 89 LNode* newElement = new LNode( lp, NULL);93 LNode* newElement = new LNode(t, i, p, NULL); 90 94 temp->next = newElement; 91 95 return this; … … 120 124 int LNode::getIndex() { 121 125 return data->getIndex(); 126 } 127 128 bool LNode::getDel() { 129 return data->getDel(); 130 } 131 132 // set the data from the LPoly saved in LNode 133 void LNode::setPoly(poly p) { 134 data->setPoly(p); 135 } 136 137 void LNode::setTerm(poly t) { 138 data->setTerm(t); 139 } 140 141 void LNode::setIndex(int i) { 142 data->setIndex(i); 143 } 144 145 void LNode::setDel(bool d) { 146 data->setDel(d); 122 147 } 123 148 … … 144 169 */ 145 170 171 LList::LList() { 172 first = new LNode(); 173 length = 0; 174 } 175 146 176 LList::LList(LPoly* lp) { 147 first = new LNode(lp); 148 } 149 150 LList::LList(poly* t,int* i,poly* p) { 151 first = new LNode(t,i,p); 177 first = new LNode(lp); 178 length = 1; 179 } 180 181 LList::LList(poly t,int i,poly p) { 182 first = new LNode(t,i,p); 183 length = 1; 152 184 } 153 185 … … 159 191 void LList::insert(LPoly* lp) { 160 192 first = first->insert(lp); 161 } 162 163 void LList::insert(poly* t,int* i, poly* p) { 193 length++; 194 } 195 196 void LList::insert(poly t,int i, poly p) { 164 197 first = first->insert(t,i,p); 165 } 166 167 void LList::insertByLabel(LPoly* lp) { 168 first = first->insertByLabel(lp); 198 length++; 199 } 200 201 void LList::insertByLabel(poly t, int i, poly p) { 202 first = first->insertByLabel(t,i,p); 203 length++; 169 204 } 170 205 … … 183 218 LNode* LList::getNext(LNode* l) { 184 219 return l->getNext(); 220 } 221 222 int LList::getLength() { 223 return length; 185 224 } 186 225 … … 299 338 if(0 == pLmCmp(u1,ppMult_qq(this->data->getT1(), this->data->getLp1Term())) || 300 339 -1 == pLmCmp(u1,ppMult_qq(this->data->getT1(), this->data->getLp1Term()))) { 301 Print("Leck mich am Arsch: ");302 340 pWrite(u1); 303 341 Print("Multi-Term in CritPairs Sortierung altes Element: "); … … 386 424 CNode* temp = this; 387 425 while( NULL != temp->data ) { 388 while( temp->next->data->getDeg() == this->data->getDeg()) {426 while(NULL != temp->next->data && temp->next->data->getDeg() == this->data->getDeg()) { 389 427 temp = temp->next; 390 428 } 391 429 CNode* returnCNode = temp->next; 392 temp->next = NULL; 430 // every CList should end with a (NULL,NULL) element for a similar behaviour 431 // using termination conditions throughout the algorithm 432 temp->next = new CNode(); 393 433 return returnCNode; 394 434 } 395 435 return NULL; 436 } 437 438 CPair* CNode::getData() { 439 return data; 440 } 441 442 CNode* CNode::getNext() { 443 return next; 444 } 445 446 LPoly* CNode::getAdLp1() { 447 return this->data->getAdLp1(); 448 } 449 450 LPoly* CNode::getAdLp2() { 451 return this->data->getAdLp2(); 396 452 } 397 453 … … 424 480 } 425 481 482 poly* CNode::getAdT1() { 483 return this->data->getAdT1(); 484 } 485 426 486 poly CNode::getT2() { 427 487 return this->data->getT2(); 488 } 489 490 poly* CNode::getAdT2() { 491 return this->data->getAdT2(); 492 } 493 494 Rule* CNode::getLastRuleTested() { 495 return this->data->getLastRuleTested(); 428 496 } 429 497 … … 472 540 } 473 541 542 CNode* CList::getFirst() { 543 return first; 544 } 545 474 546 // get the first elements from CList which by the above sorting have minimal degree 475 547 // returns the pointer on the first element of those … … 510 582 } 511 583 584 RNode* RNode::insert(int i, poly t, LPoly* l) { 585 Rule* r = new Rule(i,t,l); 586 RNode* newElement = new RNode(r); 587 newElement->next = this; 588 return newElement; 589 } 590 512 591 RNode* RNode::getNext() { 513 592 return next; … … 537 616 RList::RList(Rule* r) { 538 617 first = new RNode(r); 618 } 619 620 void RList::insert(int i, poly t, LPoly* l) { 621 first = first->insert(i,t,l); 539 622 } 540 623
Note: See TracChangeset
for help on using the changeset viewer.