Changeset 87beab7 in git for kernel/f5lists.cc
 Timestamp:
 Feb 11, 2009, 10:24:08 PM (14 years ago)
 Branches:
 (u'jengelhdatetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', 'f875bbaccd0831e36aaed09ff6adeb3eb45aeb94')
 Children:
 34fcf813ea36a30ddd0d8107abf9a73b247be289
 Parents:
 c5d8ddb1112344ad68257ea0c296d5b17aee0433
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

kernel/f5lists.cc
rc5d8dd r87beab7 27 27 // generating new list elements (labeled / classical polynomial / LNode view) 28 28 LNode::LNode() { 29 data = NULL; 30 next = NULL; 29 data = NULL; 30 next = NULL; 31 gPrevRedCheck = NULL; 32 completedRedCheck = NULL; 31 33 } 32 34 LNode::LNode(LPoly* lp) { 33 data = lp; 34 next = NULL; 35 data = lp; 36 next = NULL; 37 gPrevRedCheck = NULL; 38 completedRedCheck = NULL; 35 39 } 36 40 37 41 LNode::LNode(LPoly* lp, LNode* l) { 38 data = lp; 39 next = l; 40 } 41 LNode::LNode(poly t, int i, poly p) { 42 LPoly* lp = new LPoly(t,i,p); 43 data = lp; 44 next = NULL; 42 Print("HIER LNODE\n"); 43 data = lp; 44 next = l; 45 gPrevRedCheck = NULL; 46 completedRedCheck = NULL; 47 } 48 49 LNode::LNode(poly t, int i, poly p, Rule* r, LNode* gPCheck, LNode* CompCheck) { 50 LPoly* lp = new LPoly(t,i,p,r); 51 data = lp; 52 next = NULL; 53 gPrevRedCheck = gPCheck; 54 completedRedCheck = CompCheck; 45 55 } 46 56 47 LNode::LNode(poly t, int i, poly p, LNode* l) { 48 LPoly* lp = new LPoly(t,i,p); 49 data = lp; 50 next = l; 57 LNode::LNode(poly t, int i, poly p, Rule* r, LNode* gPCheck, LNode* CompCheck, LNode* l) { 58 LPoly* lp = new LPoly(t,i,p,r); 59 data = lp; 60 next = l; 61 gPrevRedCheck = gPCheck; 62 completedRedCheck = CompCheck; 51 63 } 52 64 53 65 LNode::LNode(LNode* ln) { 54 data = ln>getLPoly(); 55 next = ln>getNext(); 66 data = ln>getLPoly(); 67 next = ln>getNext(); 68 gPrevRedCheck = NULL; 69 completedRedCheck = NULL; 56 70 } 57 71 58 72 LNode::~LNode() { 59 73 delete next; 74 delete gPrevRedCheck; 75 delete completedRedCheck; 60 76 delete data; 61 77 } … … 63 79 // insert new elements to the list always in front (labeled / classical polynomial view) 64 80 LNode* LNode::insert(LPoly* lp) { 81 Print("HIER\n"); 65 82 LNode* newElement = new LNode(lp, this); 66 83 return newElement; 67 84 } 68 85 69 LNode* LNode::insert(poly t, int i, poly p ) {70 LNode* newElement = new LNode(t, i, p, this);86 LNode* LNode::insert(poly t, int i, poly p, Rule* r) { 87 LNode* newElement = new LNode(t, i, p, r, NULL, NULL, this); 71 88 return newElement; 72 89 } … … 74 91 // insert new elemets to the list w.r.t. increasing labels 75 92 // only used for the Spolys to be reduced (TopReduction building new Spolys with higher label) 76 LNode* LNode::insertByLabel(poly t, int i, poly p ) {93 LNode* LNode::insertByLabel(poly t, int i, poly p, Rule* r) { 77 94 if(0 == pLmCmp(t,this>getTerm())  1 == pLmCmp(t,this>getTerm())) { 78 LNode* newElement = new LNode(t, i, p, this);95 LNode* newElement = new LNode(t, i, p, r, this); 79 96 return newElement; 80 97 } … … 83 100 while( NULL != temp>next>data ) { 84 101 if( 0 == pLmCmp(t,temp>next>getTerm())  1 == pLmCmp(t,temp>next>getTerm())) { 85 LNode* newElement = new LNode(t, i, p, temp>next);102 LNode* newElement = new LNode(t, i, p, r, temp>next); 86 103 temp>next = newElement; 87 104 return this; … … 91 108 } 92 109 } 93 LNode* newElement = new LNode(t, i, p, NULL);110 LNode* newElement = new LNode(t, i, p, r, NULL); 94 111 temp>next = newElement; 95 112 return this; … … 126 143 } 127 144 145 Rule* LNode::getRule() { 146 return data>getRule(); 147 } 148 149 LNode* LNode::getGPrevRedCheck() { 150 return gPrevRedCheck; 151 } 152 153 LNode* LNode::getCompletedRedCheck() { 154 return completedRedCheck; 155 } 156 128 157 // set the data from the LPoly saved in LNode 129 158 void LNode::setPoly(poly p) { … … 137 166 void LNode::setIndex(int i) { 138 167 data>setIndex(i); 168 } 169 170 void LNode::setGPrevRedCheck(LNode* l) { 171 gPrevRedCheck = l; 172 } 173 174 void LNode::setCompletedRedCheck(LNode* l) { 175 completedRedCheck = l; 139 176 } 140 177 … … 171 208 } 172 209 173 LList::LList(poly t,int i,poly p ) {174 first = new LNode(t,i,p );210 LList::LList(poly t,int i,poly p,Rule* r) { 211 first = new LNode(t,i,p,r); 175 212 length = 1; 176 213 } … … 186 223 } 187 224 188 void LList::insert(poly t,int i, poly p ) {189 first = first>insert(t,i,p );225 void LList::insert(poly t,int i, poly p, Rule* r) { 226 first = first>insert(t,i,p,r); 190 227 length++; 191 228 } 192 229 193 void LList::insertByLabel(poly t, int i, poly p) { 194 first = first>insertByLabel(t,i,p); 230 void LList::insertByLabel(poly t, int i, poly p, Rule* r) { 231 first = first>insertByLabel(t,i,p,r); 232 length++; 233 } 234 235 void LList::insertByLabel(LNode* l) { 236 first = first>insertByLabel(l>getTerm(),l>getIndex(),l>getPoly(),l>getRule()); 195 237 length++; 196 238 } … … 222 264 } 223 265 224 /*225 ===================================226 functions working on the class LRed227 ===================================228 */229 LRed::LRed() {230 data = NULL;231 gPrevRedCheck = NULL;232 completedRedCheck = NULL;233 }234 235 LRed::LRed(poly t,int i,poly p,LNode* g, LNode* c) {236 LPoly* lp = new LPoly(t,i,p);237 data = lp;238 gPrevRedCheck = g;239 completedRedCheck = c;240 }241 242 LPoly* LRed::getLPoly() {243 return data;244 }245 246 LNode* LRed::getGPrevRedCheck() {247 return gPrevRedCheck;248 }249 250 LNode* LRed::getCompletedRedCheck() {251 return completedRedCheck;252 }253 254 // get the data from the LPoly saved in LNode255 poly LRed::getPoly() {256 return data>getPoly();257 }258 259 poly LRed::getTerm() {260 return data>getTerm();261 }262 263 int LRed::getIndex() {264 return data>getIndex();265 }266 267 // set the data from the LPoly saved in LNode268 void LRed::setPoly(poly p) {269 data>setPoly(p);270 }271 272 void LRed::setTerm(poly t) {273 data>setTerm(t);274 }275 276 void LRed::setIndex(int i) {277 data>setIndex(i);278 }279 266 280 267 … … 284 271 ======================================= 285 272 */ 273 LTagNode::LTagNode() { 274 data = NULL; 275 next = NULL; 276 } 286 277 287 278 LTagNode::LTagNode(LNode* l) { … … 333 324 ======================================= 334 325 */ 326 LTagList::LTagList() { 327 LTagNode* first = new LTagNode(); 328 length = 0; 329 } 335 330 336 331 LTagList::LTagList(LNode* l) { … … 347 342 LNode* LTagList::get(int idx) { 348 343 return first>get(idx, length); 344 } 345 346 LNode* LTagList::getFirst() { 347 return first>getLNode(); 348 } 349 350 351 /* 352 ===================================== 353 functions working on the class TopRed 354 ===================================== 355 */ 356 357 TopRed::TopRed() { 358 _completed = NULL; 359 _toDo = NULL; 360 } 361 362 TopRed::TopRed(LList* c, LList* t) { 363 _completed = c; 364 _toDo = t; 365 } 366 367 LList* TopRed::getCompleted() { 368 return _completed; 369 } 370 371 LList* TopRed::getToDo() { 372 return _toDo; 349 373 } 350 374 … … 635 659 } 636 660 637 RNode* RNode::insert(int i, poly t , LPoly* l) {638 Rule* r = new Rule(i,t ,l);661 RNode* RNode::insert(int i, poly t) { 662 Rule* r = new Rule(i,t); 639 663 RNode* newElement = new RNode(r); 640 664 newElement>next = this; … … 658 682 } 659 683 660 LPoly* RNode::getRuleOrigin() {661 return data>getOrigin();662 }663 664 684 /* 665 685 ==================================== … … 675 695 } 676 696 677 void RList::insert(int i, poly t , LPoly* l) {678 first = first>insert(i,t ,l);697 void RList::insert(int i, poly t) { 698 first = first>insert(i,t); 679 699 } 680 700 … … 734 754 RNode* RTagNode::get(int idx, int length) { 735 755 if(idx==1  idx==0) { 756 // NOTE: We set this NULL as putting it the last element in the list, i.e. the element having 757 // RNode* = NULL would cost lots of iterations at each step of F5inc, with increasing 758 // length of the list this should be prevented 736 759 return NULL; 737 760 } … … 739 762 int j; 740 763 RTagNode* temp = this; 741 for(j=1; j<=lengthidx+1; j++) { 764 Print("\n\nHIER IN GET IDX\n"); 765 Print("FOR LOOP: %d\n",lengthidx+1); 766 for(j=1; j<=lengthidx+1; j++) { 742 767 temp = temp>next; 743 768 } … … 750 775 } 751 776 777 void RTagNode::print() { 778 RTagNode* temp = this; 779 Print("1. element: %d",getRNode()>getRule()>getIndex()); 780 pWrite(getRNode()>getRule()>getTerm()); 781 temp = temp>next; 782 int i = 2; 783 while(NULL != temp>getRNode()) { 784 Print("%d. element: %d",i,getRNode()>getRule()>getIndex()); 785 pWrite(getRNode()>getRule()>getTerm()); 786 temp = temp>next; 787 i++; 788 } 789 } 752 790 /* 753 791 ======================================= … … 769 807 void RTagList::insert(RNode* r) { 770 808 first = first>insert(r); 771 length++; 809 Print("LENGTH:%d\n",length); 810 length = length +1; 811 Print("LENGTH:%d\n",length); 772 812 } 773 813 … … 783 823 first>set(r); 784 824 } 825 826 void RTagList::print() { 827 first>print(); 828 } 829 830 int RTagList::getLength() { 831 return length; 832 } 785 833 #endif
Note: See TracChangeset
for help on using the changeset viewer.