source: git/kernel/f5lists.cc @ 9cb4078

jengelh-datetimespielwiese
Last change on this file since 9cb4078 was 9cb4078, checked in by Christian Eder, 14 years ago
implemented interreduction, still with lots of bugs => commented out git-svn-id: file:///usr/local/Singular/svn/trunk@11514 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 23.3 KB
Line 
1#include "mod2.h"
2
3#ifdef HAVE_F5
4#include "kutil.h"
5#include "structs.h"
6#include "omalloc.h"
7#include "polys.h"
8#include "p_polys.h"
9#include "ideals.h"
10#include "febase.h"
11#include "kstd1.h"
12#include "khstd.h"
13#include "kbuckets.h"
14#include "weight.h"
15#include "intvec.h"
16#include "pInline1.h"
17#include "f5gb.h"
18#include "f5data.h"
19#include "f5lists.h"
20
21/*
22====================================
23functions working on the class LNode
24====================================
25*/
26
27// generating new list elements (labeled / classical polynomial / LNode view)
28LNode::LNode() {
29    data                =   NULL;
30    next                =   NULL;
31}
32LNode::LNode(LPoly* lp) {
33    data                =   lp;
34    next                =   NULL;
35}
36       
37LNode::LNode(LPoly* lp, LNode* l) {
38//Print("HIER LNODE\n");
39    data                =   lp;
40    next                =   l;
41}
42
43LNode::LNode(poly t, int i, poly p, Rule* r) {
44LPoly* lp           =   new LPoly(t,i,p,r);
45data                =   lp;
46next                =   NULL;
47}
48       
49LNode::LNode(poly t, int i, poly p, Rule* r, LNode* l) {
50    LPoly* lp           =   new LPoly(t,i,p,r);
51    data                =   lp;
52    next                =   l;
53}
54
55LNode::LNode(LNode* ln) {
56    data                =   ln->getLPoly();
57    next                =   ln->getNext();
58}
59       
60LNode::~LNode() {
61    //delete next;
62    Print("DELETE LNODE\n");
63    delete data;   
64}
65
66void LNode::deleteAll() {
67    while(NULL != next) {
68        Print("%p\n",next);
69        pWrite(next->data->getPoly());
70        next->deleteAll();
71    }
72    delete data;
73}
74
75// insert new elements to the list always at the end (labeled / classical polynomial view)
76// needed for list gPrev
77inline LNode* LNode::insert(LPoly* lp) {
78    //Print("INSERTION: \n");
79    //Print("LAST GPREV: ");
80    //pWrite(this->getPoly());
81    LNode* newElement   =   new LNode(lp, NULL);
82    this->next          =   newElement;
83    return newElement;
84}
85       
86inline LNode* LNode::insert(poly t, int i, poly p, Rule* r) {
87    LNode* newElement   =   new LNode(t, i, p, r, NULL);
88    this->next          =   newElement;
89    return newElement;
90}
91
92// insert new elements to the list always in front (labeled / classical polynomial view)
93// needed for sPolyList
94inline LNode* LNode::insertSP(LPoly* lp) {
95    LNode* newElement   =   new LNode(lp, this);
96    //Print("INSERTED IN SPOLYLIST: ");
97    //pWrite(lp->getTerm());
98    return newElement;
99}
100       
101inline LNode* LNode::insertSP(poly t, int i, poly p, Rule* r) {
102    LNode* newElement   =   new LNode(t, i, p, r, this);
103     //Print("INSERTED IN SPOLYLIST: ");
104  //pWrite(t);
105return newElement;
106}
107// insert new elemets to the list w.r.t. increasing labels
108// only used for the S-polys to be reduced (TopReduction building new S-polys with higher label)
109inline LNode* LNode::insertByLabel(poly t, int i, poly p, Rule* r) {
110    //Print("ADDING SOLYS TO THE LIST\n");
111    //Print("new element: ");
112    //pWrite(t);
113       if(NULL == this || NULL == data) {
114        LNode* newElement   =   new LNode(t, i, p, r, this);
115        return newElement;
116    }
117    else {
118         //Print("tested element1: ");
119    //pWrite(this->getTerm());
120        if(-1 == pLmCmp(t,this->getTerm())) {
121            //Print("HIERDRIN\n");
122            LNode* newElement   =   new LNode(t, i, p, r, this);
123            //Print("%p\n",this);
124            //Print("%p\n",newElement->next);
125            return newElement;
126        }
127        else {
128            LNode* temp = this;
129            while(NULL != temp->next && NULL != temp->next->data) {
130                //Print("tested element: ");
131                //pWrite(temp->getTerm());
132 if(-1 == pLmCmp(t,temp->next->getTerm())) {
133                    LNode* newElement   =   new LNode(t, i, p, r, temp->next);
134                    temp->next          =   newElement;
135                    return this;
136                }
137                else {
138                    temp = temp->next;
139                    //Print("%p\n",temp);
140                    //Print("%p\n",temp->data);
141                   
142                    //Print("%p\n",temp->next);
143                }
144            }
145        //Print("HIER\n");
146            LNode* newElement   =   new LNode(t, i, p, r, temp->next);
147            temp->next          =   newElement;
148            return this;
149        }
150    }
151}
152
153// deletes the first elements of the list with the same degree
154// only used for the S-polys, which are already sorted by increasing degree by CList
155LNode*  LNode::deleteByDeg() {
156    return this;
157}
158
159// get next from current LNode
160LNode* LNode::getNext() {
161    return next;
162}
163
164// get the LPoly* out of LNode*
165LPoly* LNode::getLPoly() {
166    return data;
167}
168
169// get the data from the LPoly saved in LNode
170poly LNode::getPoly() {
171    return data->getPoly();
172}
173
174poly LNode::getTerm() {
175    return data->getTerm();
176}
177
178int LNode::getIndex() {
179    return data->getIndex();
180}
181
182Rule* LNode::getRule() {
183    return data->getRule();
184}
185
186// set the data from the LPoly saved in LNode
187void LNode::setPoly(poly p) {
188    data->setPoly(p);
189}
190
191void LNode::setTerm(poly t) {
192    data->setTerm(t);
193}
194
195void LNode::setIndex(int i) {
196    data->setIndex(i);
197}
198
199void LNode::setNext(LNode* l) {
200    next    =   l;
201}
202
203// test if for any list element the polynomial part of the data is equal to *p
204bool LNode::polyTest(poly* p) {
205    LNode* temp = new LNode(this);
206    while(NULL != temp) {
207        if(pComparePolys(temp->getPoly(),*p)) {
208            return 1;
209        }
210        temp = temp->next;
211    }
212    return 0;
213}
214
215LNode* LNode::getNext(LNode* l) {
216    return l->next;
217}
218
219// for debugging
220void LNode::print() {
221    LNode* temp = this;
222    Print("___________________List of S-polynomials______________________:\n");
223    Print("%p\n",this);
224    while(NULL != temp && NULL != temp->data) {
225        Print("Index: %d\n",temp->getIndex());
226        Print("Term: ");
227        pWrite(temp->getTerm());
228        Print("Poly: ");
229        pWrite(temp->getPoly());
230        Print("%p\n",temp->next);
231        temp = temp->next;
232    }
233    Print("_______________________________________________________________\n");
234}
235
236
237/*
238====================================
239functions working on the class LList
240====================================
241*/
242
243LList::LList() {
244    first   =   new LNode();
245    last    =   first;
246    length  =   0;
247}
248
249LList::LList(LPoly* lp) {
250    first   =   new LNode(lp);
251    last    =   first;
252    length  =   1;
253}
254
255LList::LList(poly t,int i,poly p,Rule* r) {
256    first   =   new LNode(t,i,p,r);
257    last    =   first;
258    length  =   1;
259} 
260
261LList::~LList() {
262    LNode* temp;
263    while(first) {
264        temp    =   first;
265        first   =   first->getNext();
266        delete  temp;
267        Print("%p\n",first);
268    }
269}
270
271// insertion at the end of the list, needed for gPrev
272void LList::insert(LPoly* lp) {
273    last = last->insert(lp);
274    //Print("NEW LAST GPREV: ");
275    //pWrite(last->getPoly());
276    length++;
277    //Print("LENGTH %d\n",length);
278}
279
280void LList::insert(poly t,int i, poly p, Rule* r) {
281    last = last->insert(t,i,p,r);
282    length++;
283    //Print("LENGTH %d\n",length);
284}
285
286// insertion in front of the list, needed for sPolyList
287void LList::insertSP(LPoly* lp) {
288    first = first->insertSP(lp);
289    length++;
290    //Print("LENGTH %d\n",length);
291}
292
293void LList::insertSP(poly t,int i, poly p, Rule* r) {
294    first = first->insertSP(t,i,p,r);
295    length++;
296    //Print("LENGTH %d\n",length);
297}
298
299
300void LList::insertByLabel(poly t, int i, poly p, Rule* r) {
301    first = first->insertByLabel(t,i,p,r);
302    length++;
303    //Print("LENGTH %d\n",length);
304}
305
306void LList::insertByLabel(LNode* l) {
307    first = first->insertByLabel(l->getTerm(),l->getIndex(),l->getPoly(),l->getRule());
308    length++;
309    //Print("LENGTH %d\n",length);
310}
311
312void LList::deleteByDeg() {
313    first = first->deleteByDeg();
314}
315
316bool LList::polyTest(poly* p) {
317    return first->polyTest(p);
318}
319
320LNode* LList::getFirst() {
321    return first;
322}
323
324LNode* LList::getLast() {
325    return last;
326}
327
328int LList::getLength() {
329    return length;
330}
331
332void LList::setFirst(LNode* l) {
333    LNode* temp =   first;
334    temp->setNext(NULL);
335    first       =   l;
336    length--;
337}
338
339void LList::print() {
340    first->print();
341}
342
343/*
344=======================================
345functions working on the class LTagNode
346=======================================
347*/
348LTagNode::LTagNode() {
349    data    =   NULL;
350    next    =   NULL;
351}
352
353LTagNode::LTagNode(LNode* l) {
354    data = l;
355    next = NULL;
356}
357       
358LTagNode::LTagNode(LNode* l, LTagNode* n) {
359    data = l;
360    next = n;
361}
362
363 LTagNode::~LTagNode() {
364    delete next;
365    delete data;   
366}
367       
368// declaration with first as parameter due to sorting of LTagList
369LTagNode* LTagNode::insert(LNode* l) {
370    LTagNode* newElement  = new LTagNode(l, this);
371    return newElement;
372}
373
374LNode* LTagNode::getLNode() {
375    return this->data;
376}
377
378LTagNode* LTagNode::getNext() {
379    return next;
380}
381
382// NOTE: We insert at the beginning of the list and length = i-1, where i is the actual index.
383//       Thus given actual index i and idx being the index of the LPoly under investigation
384//       the element on position length-idx is the right one
385LNode* LTagNode::get(int idx, int length) {
386    if(idx == 1) {
387        return NULL;
388    }
389    else {
390        int j;
391        LTagNode* temp = this; // last
392        for(j=1;j<=length-idx+1;j++) {
393            temp = temp->next;
394        }
395        return temp->data;
396    }
397}
398
399
400/*
401=======================================
402functions working on the class LTagList
403=======================================
404*/
405LTagList::LTagList() {
406    LTagNode* first =   new LTagNode();
407   
408    length          =   0;
409}
410
411LTagList::LTagList(LNode* l) {
412    LTagNode* first =   new LTagNode(l);
413    length          =   1;
414}
415
416// declaration with first as parameter in LTagNode due to sorting of LTagList
417void LTagList::insert(LNode* l) {
418    first   =   first->insert(l);
419    length++;
420}
421
422void LTagList::setFirstCurrentIdx(LNode* l) {
423    firstCurrentIdx =   l;
424}
425
426LNode* LTagList::get(int idx) {
427    return first->get(idx, length);
428}
429
430LNode* LTagList::getFirst() {
431    return first->getLNode();
432}
433
434LNode* LTagList::getFirstCurrentIdx() {
435    return firstCurrentIdx;
436}
437
438/*
439=====================================
440functions working on the class TopRed
441=====================================
442*/
443
444TopRed::TopRed() {
445    _completed  =   NULL;
446    _toDo       =   NULL;
447}
448
449TopRed::TopRed(LList* c, LList* t) {
450    _completed  =   c;
451    _toDo       =   t;
452}
453
454LList* TopRed::getCompleted() {
455    return _completed;
456}
457
458LList* TopRed::getToDo() {
459    return _toDo;
460}
461
462/*
463====================================
464functions working on the class CNode
465====================================
466*/
467
468CNode::CNode() {
469    data    =   NULL;   
470    next    =   NULL;   
471}
472
473CNode::CNode(CPair* c) {
474    data    =   c;   
475    next    =   NULL;   
476}
477
478CNode::CNode(CPair* c, CNode* n) {
479    data    =   c;   
480    next    =   n;   
481}
482
483CNode::~CNode() {
484    delete data;
485}
486
487// insert sorts the critical pairs firstly by increasing total degree, secondly by increasing label
488// note: as all critical pairs have the same index here, the second sort is done on the terms of the labels
489// working only with linked, but not doubly linked lists due to memory usage we have to check the
490// insertion around the first element separately from the insertion around all other elements in the list
491CNode* CNode::insert(CPair* c, CNode* last) {
492    if(NULL == this->data) {
493        CNode* newElement   =   new CNode(c, this);
494        return newElement;
495    }
496    else {
497        poly u1 = ppMult_qq(c->getT1(),c->getLp1Term());
498        if( c->getDeg() < this->data->getDeg() ) { // lower degree than the first list element
499            CNode* newElement   =   new CNode(c, this);
500            return newElement;
501        }
502        if( c->getDeg() == this->data->getDeg() ) { // same degree than the first list element
503            if(1 != pLmCmp(u1,ppMult_qq(this->data->getT1(), this->data->getLp1Term()))) {
504                //pWrite(u1);
505                //Print("Multi-Term in CritPairs Sortierung altes Element: ");
506                //pWrite(ppMult_qq(this->data->getT1(),this->data->getLp1Term()));
507                CNode* newElement   =   new CNode(c, this);
508                return newElement;
509            }
510            else {
511                //Print("Insert Deg\n");
512                CNode* temp = this;
513                while(  NULL != temp->next->data ) {
514                    if(temp->next->data->getDeg() == c->getDeg() ) { 
515                        if(1 == pLmCmp(u1,ppMult_qq(temp->next->data->getT1(),temp->next->data->getLp1Term()))) {
516                            temp = temp->next;
517                        }
518                        else {
519                            CNode* newElement   =   new CNode(c, temp->next);
520                            temp->next          =   newElement;
521                            return this;
522                        } 
523                    }
524                    else {
525                        CNode* newElement   =   new CNode(c, temp->next);
526                        temp->next          =   newElement;
527                        return this;
528                    }
529                }
530                CNode* newElement   =   new CNode(c, last);
531                temp->next          =   newElement;
532                return this;
533            }
534        } // outer if-clause
535        if( c->getDeg() > this->data->getDeg() ) { // greater degree than the first list element
536            CNode* temp =   this;
537            while( NULL != temp->next->data ) {   
538                if( c->getDeg() < temp->next->data->getDeg() ) {
539                    CNode* newElement   =   new CNode(c, temp->next);
540                    temp->next          =   newElement;
541                    return this;
542                }
543                if( c->getDeg() == temp->next->data->getDeg() ) {
544                    if(1 != pLmCmp(u1,ppMult_qq(temp->next->data->getT1(),temp->next->data->getLp1Term()))) { 
545                        CNode* newElement   =   new CNode(c, temp->next);
546                        temp->next          =   newElement;
547                        return this;
548                    }
549                    else {
550                        temp = temp->next;
551                        while(  NULL != temp->next->data ) {
552                            if( temp->next->data->getDeg() == c->getDeg() ) { 
553                                if(1 == pLmCmp(u1,ppMult_qq(temp->next->data->getT1(),
554                                               temp->next->data->getLp1Term()))) {
555                                    temp = temp->next;
556                                }
557                                else {
558                                    CNode* newElement   =   new CNode(c, temp->next);
559                                    temp->next          =   newElement;
560                                    return this;
561                                } 
562                            }
563                            else {
564                                CNode* newElement   =   new CNode(c, temp->next);
565                                temp->next          =   newElement;
566                                return this;
567                            }
568                        }
569                        CNode* newElement   =   new CNode(c, last);
570                        temp->next          =   newElement;
571                        return this;
572                    }
573                }
574                if( c->getDeg() > temp->next->data->getDeg() ) {
575                    temp    =   temp->next;
576                }
577            }
578            CNode* newElement   =   new CNode(c, last);
579            temp->next          =   newElement;
580            return this;
581        }
582    }
583}
584
585// get the first elements from CList which by the above sorting have minimal degree
586CNode* CNode::getMinDeg() {
587    CNode* temp = this;
588    while( NULL != temp->data ) {
589        while(NULL != temp->next->data && temp->next->data->getDeg() == this->data->getDeg()) {
590            temp = temp->next;
591        }
592        CNode* returnCNode  =   temp->next;   
593        // every CList should end with a (NULL,NULL) element for a similar behaviour
594        // using termination conditions throughout the algorithm
595        temp->next          =   new CNode();
596        return returnCNode;
597    }
598    return NULL;
599}
600
601CPair* CNode::getData() {
602    return data;
603}
604
605CNode* CNode::getNext() {
606    return next;
607}
608
609LPoly* CNode::getAdLp1() {
610    return this->data->getAdLp1();
611}
612
613LPoly* CNode::getAdLp2() {
614    return this->data->getAdLp2();
615}
616
617poly CNode::getLp1Poly() {
618    return this->data->getLp1Poly();
619}
620
621poly CNode::getLp2Poly() {
622    return this->data->getLp2Poly();
623}
624
625poly CNode::getLp1Term() {
626    return this->data->getLp1Term();
627}
628
629poly CNode::getLp2Term() {
630    return this->data->getLp2Term();
631}
632
633int CNode::getLp1Index() {
634    return this->data->getLp1Index();
635}
636
637int CNode::getLp2Index() {
638    return this->data->getLp2Index();
639}
640
641poly CNode::getT1() {
642    return this->data->getT1();
643}
644
645poly* CNode::getAdT1() {
646    return this->data->getAdT1();
647}
648
649poly CNode::getT2() {
650    return this->data->getT2();
651}
652
653poly* CNode::getAdT2() {
654    return this->data->getAdT2();
655}
656
657Rule* CNode::getTestedRule() {
658    return this->data->getTestedRule();
659}
660
661// for debugging
662void CNode::print() {
663    CNode* temp = this;
664    Print("___________________List of critical pairs______________________:\n");
665    while(NULL != temp->data) {
666        Print("LP1 Index: %d\n",temp->getLp1Index());
667        Print("T1: ");
668        pWrite(temp->getT1());
669        Print("LP1 Term: ");
670        pWrite(temp->getLp1Term());
671        Print("LP1 Poly: ");
672        pWrite(temp->getLp1Poly());
673        Print("LP2 Index: %d\n",temp->getLp2Index());
674        Print("T2: ");
675        pWrite(temp->getT2());
676        Print("LP2 Term: ");
677        pWrite(temp->getLp2Term());
678        Print("LP2 Poly: ");
679        pWrite(temp->getLp2Poly());
680        Print("\n");
681        temp = temp->next;
682    }
683}
684
685/*
686====================================
687functions working on the class CList
688====================================
689*/
690// for initialization of CLists, last element alwas has data=NULL and next=NULL
691CList::CList() {
692    first   =   new CNode();
693    last    =   first;
694}
695
696CList::CList(CPair* c) {
697    first   =   new CNode(c);
698    last    =   first;
699}
700
701CList::~CList() {
702    CNode* temp;
703    while(first) {
704        temp    =   first;
705        first   =   first->getNext();
706        delete  temp;
707    }
708}
709
710// insert sorts the critical pairs firstly by increasing total degree, secondly by increasing label
711// note: as all critical pairs have the same index here, the second sort is done on the terms of the labels
712void CList::insert(CPair* c) {
713    first = first->insert(c, last);
714}
715
716CNode* CList::getFirst() {
717    return first;
718}
719
720// get the first elements from CList which by the above sorting have minimal degree
721// returns the pointer on the first element of those
722CNode* CList::getMinDeg() {
723    CNode* temp     =   first;
724    first           =   first->getMinDeg();
725    return temp;
726}
727
728void CList::print() {
729    first->print();
730}
731
732/*
733====================================
734functions working on the class RNode
735====================================
736*/
737RNode::RNode() {
738    data    =   NULL;
739    next    =   NULL;
740}
741
742RNode::RNode(Rule* r) {
743    data    =   r;
744    next    =   NULL;
745}
746
747RNode::~RNode() {
748    Print("DELETE RULE\n");
749    delete  data;
750}
751
752RNode* RNode::insert(Rule* r) {
753    RNode* newElement   =   new RNode(r);
754    newElement->next    =   this;
755    return newElement;
756}
757
758RNode* RNode::insert(int i, poly t) {
759    Rule*   r           =   new Rule(i,t);
760    RNode* newElement   =   new RNode(r);
761    newElement->next    =   this;
762    return newElement;
763}
764
765RNode* RNode::getNext() {
766    return next;
767}   
768
769Rule* RNode::getRule() {
770    return data;
771}
772
773int RNode::getRuleIndex() {
774    return data->getIndex();
775}
776
777poly RNode::getRuleTerm() {
778    return data->getTerm();
779}
780
781/*
782====================================
783functions working on the class RList
784====================================
785*/
786RList::RList() {
787    first = new RNode();
788}
789
790RList::RList(Rule* r) {
791    first = new RNode(r);
792}
793
794RList::~RList() {
795    RNode* temp;
796    Print("%p\n",first);
797    while(first->getRule()) {
798        temp    =   first;
799        first   =   first->getNext();
800        Print("1 %p\n",first);
801        if(first) {
802            Print("2 %p\n",first->getNext());
803            //Print("3 %p\n",first->getNext()->getRuleTerm());
804        }
805        delete  temp;
806    }
807    Print("FERTIG\n");
808} 
809
810void RList::insert(int i, poly t) {
811    first = first->insert(i,t);
812}
813
814void RList::insert(Rule* r) {
815    first = first->insert(r);
816}
817
818RNode* RList::getFirst() {
819    return first;
820}
821
822Rule* RList::getRule() {
823    return this->getRule();
824}
825
826/*
827=======================================
828functions working on the class RTagNode
829=======================================
830*/
831
832RTagNode::RTagNode() {
833    data = NULL;
834    next = NULL;
835}
836 
837RTagNode::RTagNode(RNode* r) {
838    data = r;
839    next = NULL;
840}
841       
842RTagNode::RTagNode(RNode* r, RTagNode* n) {
843    data = r;
844    next = n;
845}
846
847RTagNode::~RTagNode() {
848    delete data;   
849}
850       
851// declaration with first as parameter due to sorting of RTagList
852RTagNode* RTagNode::insert(RNode* r) {
853    //Print("Hier1\n");
854    RTagNode* newElement  = new RTagNode(r, this);
855    //Print("Hier2\n");
856    return newElement;
857}
858
859RNode* RTagNode::getRNode() {
860    return this->data;
861}
862
863RTagNode* RTagNode::getNext() {
864    return next;
865}
866
867// NOTE: We insert at the beginning of the list and length = i-1, where i is the actual index.
868//       Thus given actual index i and idx being the index of the LPoly under investigation
869//       the element on position length-idx+1 is the right one
870RNode* RTagNode::get(int idx, int length) {
871    if(idx==1 || idx==0) {
872        // NOTE: We set this NULL as putting it the last element in the list, i.e. the element having
873        //       RNode* = NULL would cost lots of iterations at each step of F5inc, with increasing
874        //       length of the list this should be prevented
875        return NULL;
876    }
877    else {
878        int j;
879        RTagNode* temp = this; 
880    //Print("\n\nHIER IN GET IDX\n");
881    //Print("FOR LOOP: %d\n",length-idx+1);   
882    for(j=1; j<=length-idx+1; j++) {
883            temp = temp->next;
884        }
885        return temp->data;
886    }
887}
888
889void RTagNode::set(RNode* r) {
890    this->data  =   r;
891}
892
893void RTagNode::print() {
894    RTagNode* temp  =   this;
895    Print("1. element: %d",getRNode()->getRule()->getIndex());
896    //pWrite(getRNode()->getRule()->getTerm());
897    temp    =   temp->next;
898    int i   =   2;
899    while(NULL != temp->getRNode()) {
900        Print("%d. element: %d",i,getRNode()->getRule()->getIndex());
901        //pWrite(getRNode()->getRule()->getTerm());
902        temp    =   temp->next;
903        i++;
904    }
905}
906/*
907=======================================
908functions working on the class LTagList
909=======================================
910*/
911
912RTagList::RTagList() {
913    RTagNode* first =   new RTagNode();
914    length          =   0;
915}
916
917RTagList::RTagList(RNode* r) {
918    RTagNode* first =   new RTagNode(r);
919    length          =   1;
920}
921
922RTagList::~RTagList() {
923    RTagNode* temp;
924    while(first) {
925        temp    =   first;
926        first   =   first->getNext();
927        delete  temp;
928    }
929}
930
931// declaration with first as parameter in LTagNode due to sorting of LTagList
932void RTagList::insert(RNode* r) {
933    first = first->insert(r);
934    //Print("LENGTH:%d\n",length);
935    length = length +1;
936    //Print("LENGTH:%d\n",length);
937}
938
939RNode* RTagList::getFirst() {
940    return first->getRNode();
941}
942
943RNode* RTagList::get(int idx) {
944    return first->get(idx, length);
945}
946
947void RTagList::setFirst(RNode* r) {
948    first->set(r);
949}
950
951void RTagList::print() {
952    first->print();
953}
954
955int RTagList::getLength() {
956    return length;
957}
958#endif
Note: See TracBrowser for help on using the repository browser.