Changeset ab76b4 in git for kernel/f5lists.cc
- Timestamp:
- Mar 8, 2010, 11:49:06 AM (13 years ago)
- Branches:
- (u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', 'a800fe4b3e9d37a38c5a10cc0ae9dfa0c15a4ee6')
- Children:
- c1a5fdccad23660f683eef44f4ca207fa4050c1c
- Parents:
- 56b0c82650ffab78c72a5629796b5fe751482448
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/f5lists.cc
r56b0c8 rab76b4 19 19 #include "f5lists.h" 20 20 21 /** 22 * functions working on the class PNode 23 */ 24 PNode::PNode(poly p, PNode* n) { 25 data = p; 26 next = n; 27 } 28 29 poly PNode::getPoly() { 30 return this->data; 31 } 32 33 PNode* PNode::getNext() { 34 return this->next; 35 } 36 PNode* PNode::insert(poly p) { 37 poly q = pOne(); 38 q = pCopy(p); 39 PNode* temp = this; 40 if(NULL == temp) { 41 PNode* pn = new PNode(q,temp); 42 return pn; 43 } 44 if(1 == pLmCmp(q,temp->getPoly())) { 45 PNode* pn = new PNode(q,temp); 46 return pn; 47 } 48 if(0 == pLmCmp(q,temp->getPoly())) { 49 return this; 50 } 51 if(-1 == pLmCmp(q,temp->getPoly())) { 52 while(NULL != temp->getNext() && -1 == pLmCmp(q,temp->getNext()->getPoly())) { 53 temp = temp->getNext(); 54 } 55 if(NULL == temp->getNext() || 1 == pLmCmp(q,temp->getNext()->getPoly())) { 56 PNode* pn = new PNode(q,temp->getNext()); 57 temp->next = pn; 58 return this; 59 } 60 if(0 == pLmCmp(q,temp->getNext()->getPoly())) { 61 return this; 62 } 63 } 64 } 65 /* 66 PNode* PNode::insert(poly p) { 67 PNode* pn = new PNode(p,this); 68 return pn; 69 } 70 */ 71 /** 72 * functions working on the class PList 73 */ 74 PList::PList() { 75 first = NULL; 76 } 77 78 79 void PList::insert(poly p) { 80 first = first->insert(p); 81 } 82 83 84 /* 85 PNode* PList::insert(poly p) { 86 PNode* temp = first; 87 PNode* pn = new PNode(p,temp); 88 first = pn; 89 return first; 90 } 91 */ 92 bool PList::check(poly p) { 93 PNode* temp = first; 94 //Print("\nCHECK: \n"); 95 //pWrite(p); 96 //Print("-----\n"); 97 while(NULL != temp) { 98 //pWrite(temp->getPoly()); 99 //pWrite(p); 100 //Print("COMAPRE: %d\n",pLmEqual(p,temp->getPoly())); 101 if(1 == pLmEqual(p,temp->getPoly())) { 102 //Print("YES!\n"); 103 //pWrite(pHead(temp->getPoly())); 104 //Print("YES!\n"); 105 return 1; 106 } 107 temp = temp->getNext(); 108 } 109 //Print("NOTHING!\n"); 110 return 0; 111 } 112 113 void PList::print() { 114 Print("-----LIST-----\n"); 115 PNode* temp = first; 116 while(NULL != temp) { 117 pWrite(temp->getPoly()); 118 temp = temp->getNext(); 119 } 120 } 21 121 /* 22 122 ==================================== … … 293 393 LNode* temp = this; 294 394 Print("___________________List of S-polynomials______________________:\n"); 295 Print("%p\n",this);296 395 while(NULL != temp && NULL != temp->data) { 297 396 Print("Index: %d\n",temp->getIndex()); … … 300 399 Print("Poly: "); 301 400 pWrite(temp->getPoly()); 302 Print("%p\n",temp->getPoly());303 Print("DELETE? %d\n",temp->getDel());304 401 temp = temp->next; 305 402 } … … 695 792 } 696 793 794 795 CNode* CNode::insertWithoutSort(CPairOld* cp) { 796 CNode* newElement = new CNode(cp); 797 newElement->next = this; 798 return newElement; 799 } 800 801 697 802 // get the first elements from CListOld which by the above sorting have minimal degree 698 803 CNode* CNode::getMinDeg() { … … 831 936 } 832 937 938 void CListOld::insertWithoutSort(CPairOld* c) { 939 first = first->insertWithoutSort(c); 940 } 941 833 942 CNode* CListOld::getFirst() { 834 943 return first;
Note: See TracChangeset
for help on using the changeset viewer.