source: git/kernel/f5lists.h @ a82c308

spielwiese
Last change on this file since a82c308 was 599326, checked in by Kai Krüger <krueger@…>, 14 years ago
Anne, Kai, Frank: - changes to #include "..." statements to allow cleaner build structure - affected directories: omalloc, kernel, Singular - not yet done: IntergerProgramming git-svn-id: file:///usr/local/Singular/svn/trunk@13032 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 10.4 KB
Line 
1/****************************************
2*  Computer Algebra System SINGULAR     *
3****************************************/
4/* $Id$ */
5/*
6* ABSTRACT: list interface
7*/
8#include <kernel/f5data.h>
9#ifndef F5LISTS_HEADER
10#define F5LISTS_HEADER
11
12#ifdef HAVE_F5
13/*
14============================
15============================
16classes for lists used in F5
17============================
18============================
19*/
20class PNode;
21class PList;
22class LNode;
23class LList;
24class LTagNode;
25class LTagList;
26class CNode;
27class CListOld;
28class RList;
29class RNode;
30class RTagNode;
31class RTagList;
32
33
34/**
35 * class PNode of nodes of polynomials
36 */
37class PNode {
38  private: 
39    poly   data;
40    PNode*  next;
41  public:
42    PNode(poly p, PNode* n);
43    poly getPoly();
44    PNode* getNext();
45    PNode* insert(poly p);
46};
47
48/**
49 * class PList of lists of PNodes
50 */
51class PList {
52  private:
53    PNode* first;
54  public:
55    PList();
56    void insert(poly p);
57    bool check(poly p);
58    void print();
59}; 
60   
61/*
62=======================================
63class LNode (nodes for lists of LPolyOlds)
64=======================================
65*/
66class LNode {
67    private:
68        LPolyOld*  data;
69        LNode*  next;
70    public:
71        // generating new list elements from the labeled / classical polynomial view
72                LNode();
73                LNode(LPolyOld* lp);
74                LNode(LPolyOld* lp, LNode* l);
75                LNode(poly t, int i, poly p, RuleOld* r=NULL);
76                LNode(poly t, int i, poly p, RuleOld* r, LNode* l);
77                LNode(LNode* ln);
78                ~LNode();
79        void    deleteAll();
80        // insert new elements to the list at the end from the labeled / classical polynomial view
81        // needed for gPrev
82        LNode*  insert(LPolyOld* lp);
83        LNode*  insert(poly t, int i, poly p, RuleOld* r);
84        LNode*  insertByDeg(LPolyOld* lp);
85        // insert new elements to the list in front from the labeled / classical polynomial view
86        // needed for sPolyList
87        LNode*  insertSP(LPolyOld* lp);
88        LNode*  insertSP(poly t, int i, poly p, RuleOld* r);
89        // insert new elements to the list with resp. to increasing labels
90        // only used for the S-polys to be reduced (TopReduction building new S-polys with higher label)
91        LNode*  insertByLabel(poly t, int i, poly p, RuleOld* r);
92        LNode*  insertByLabel(LNode* l);
93        LNode*  insertFirst(LNode* l);
94        // deletes the first elements of the list with the same degree
95        // get next & prev from current LNode
96        LNode*  getNext();
97        LNode*  getPrev();
98        // only used for the S-polys, which are already sorted by increasing degree by CListOld
99        LNode*  deleteByDeg();
100        // get the LPolyOld* out of LNode*
101        LPolyOld*  getLPolyOld();
102        // get the data from the LPolyOld saved in LNode
103        poly    getPoly();
104        poly    getTerm();
105        int     getIndex(); 
106        RuleOld*   getRuleOld();
107        bool    getDel();
108        // set the data from the LPolyOld saved in LNode
109        void    setPoly(poly p);
110        void    setTerm(poly t);
111        void    setIndex(int i);
112        void    setNext(LNode* l);
113        void    setRuleOld(RuleOld* r);
114        void    setDel(bool d);
115        // test if for any list element the polynomial part of the data is equal to *p
116        bool    polyTest(poly* p);
117        LNode*  getNext(LNode* l);
118        void    print();
119        int     count(LNode* l);
120};
121
122
123/*
124============================
125class LList(lists of LPolyOlds)
126============================
127*/
128class LList {
129    private:
130        LNode*  first;
131        LNode*  last;
132        int     length;
133    public:
134                LList();
135                LList(LPolyOld* lp);
136                LList(poly t,int i,poly p, RuleOld* r = NULL);
137                ~LList();
138        // insertion at the end of the list
139        // needed for gPrev
140        void    insert(LPolyOld* lp);
141        void    insert(poly t,int i, poly p, RuleOld* r = NULL);
142        void    insertByDeg(LPolyOld* lp);
143        // insertion in front of the list
144        // needed for sPolyList
145        void    insertSP(LPolyOld* lp);
146        void    insertSP(poly t,int i, poly p, RuleOld* r = NULL);
147        void    insertByLabel(poly t, int i, poly p, RuleOld* r = NULL);
148        void    insertByLabel(LNode* l);
149        void    insertFirst(LNode* l);
150        void    deleteByDeg();
151        bool    polyTest(poly* p);
152        LNode*  getFirst();
153        LNode*  getLast();
154        int     getLength();
155        void    setFirst(LNode* l);
156        void    print();
157        int     count(LNode* l);
158};
159
160
161
162/*
163==============================================
164class LtagNode (nodes for lists of LPolyOld tags)
165==============================================
166*/
167class LTagNode {
168    private:
169        LNode*      data;
170        LTagNode*   next;
171    public:
172        LTagNode();
173        LTagNode(LNode* l);
174        LTagNode(LNode* l, LTagNode* n);
175        ~LTagNode();
176        // declaration with first as parameter due to sorting of LTagList
177        LTagNode*   insert(LNode* l);
178        LNode*      getLNode();
179        LTagNode*   getNext();
180        LNode*      get(int i, int length);
181};
182
183
184/*
185=========================================================================
186class LTagList(lists of LPolyOld tags, i.e. first elements of a given index)
187=========================================================================
188*/
189class LTagList {
190    private:
191        LTagNode*   first;
192        LNode*      firstCurrentIdx;
193        int         length;
194    public:
195                LTagList();
196                LTagList(LNode* l);
197                ~LTagList();
198        // declaration with first as parameter in LTagNode due to sorting of LTagList
199        void    insert(LNode* l);
200        void    setFirstCurrentIdx(LNode* l);
201        LNode*  get(int idx);
202        LNode*  getFirst();
203        LNode*  getFirstCurrentIdx();
204};
205
206LNode*  getGPrevRedCheck();
207LNode*  getcompletedRedCheck();
208
209
210/*
211======================================================================================
212class TopRed(return values of subalgorithm TopRed in f5gb.cc), i.e. the first elements
213             of the lists LList* completed & LList* sPolyList
214======================================================================================
215*/
216class TopRed {
217    private:
218        LList*  _completed;
219        LList*  _toDo;
220    public:
221                TopRed();
222                TopRed(LList* c, LList* t);
223        LList*  getCompleted();
224        LList*  getToDo();
225};
226
227
228/*
229=======================================
230class CNode (nodes for lists of CPairOlds)
231=======================================
232*/
233class CNode {
234    private:
235        CPairOld* data;
236        CNode* next;
237    public:
238                CNode();
239                CNode(CPairOld* c);
240                CNode(CPairOld* c, CNode* n);
241                ~CNode(); 
242        CNode*  insert(CPairOld* c); 
243        CNode*  insertWithoutSort(CPairOld* cp); 
244        CNode*  getMinDeg();
245        CPairOld*  getData();
246        CNode*  getNext();
247        LPolyOld*  getAdLp1();
248        LPolyOld*  getAdLp2();
249        poly    getLp1Poly();
250        poly    getLp2Poly();
251        poly    getLp1Term();
252        poly    getLp2Term();
253        poly    getT1(); 
254        poly*   getAdT1(); 
255        poly    getT2(); 
256        poly*   getAdT2(); 
257        int     getLp1Index();
258        int     getLp2Index();
259        bool    getDel();
260        RuleOld*   getTestedRuleOld();
261        void    print();
262};
263
264
265/*
266============================
267class CListOld(lists of CPairOlds)
268============================
269*/
270class CListOld {
271    private:
272        CNode*  first;
273    public:
274                // for initialization of CListOlds, last element alwas has data=NULL and next=NULL
275                CListOld(); 
276                CListOld(CPairOld* c); 
277                ~CListOld(); 
278        CNode*  getFirst();
279        void    insert(CPairOld* c);
280        void    insertWithoutSort(CPairOld* c);
281        CNode*  getMinDeg();
282        void    print();
283};
284
285
286/*
287======================================
288class RNode (nodes for lists of RuleOlds)
289======================================
290*/
291class RNode {
292    private:
293        RuleOld*   data;
294        RNode*  next;
295    public:
296                RNode();
297                RNode(RuleOld* r);
298                ~RNode();
299        RNode*  insert(RuleOld* r);
300        RNode*  insert(int i, poly t);
301        RNode*  insertOrdered(RuleOld* r);
302        RNode*  getNext();
303        RuleOld*   getRuleOld();
304        int     getRuleOldIndex();
305        poly    getRuleOldTerm();
306        void    print();
307};
308
309/*
310============================
311class RList (lists of RuleOlds)
312============================
313*/
314class RList {
315    private:
316        RNode*  first;
317        // last alway has data=NULL and next=NULL, for initialization purposes used
318        RNode*  last;
319    public:
320                RList();
321                RList(RuleOld* r);
322                ~RList();
323        void    insert(RuleOld* r);
324        void    insert(int i, poly t);
325        void    insertOrdered(RuleOld* r);
326        RNode*  getFirst();
327        RuleOld*   getRuleOld();
328        void    print();
329};
330
331
332
333/*
334=============================================
335class RtagNode (nodes for lists of RuleOld tags)
336=============================================
337*/
338class RTagNode {
339    private:
340        RNode*      data;
341        RTagNode*   next;
342    public:
343                    RTagNode();
344                    RTagNode(RNode* r);
345                    RTagNode(RNode* r, RTagNode* n);
346                    ~RTagNode();
347        // declaration with first as parameter due to sorting of LTagList
348        RTagNode*   insert(RNode* r);
349        RNode*      getRNode();
350        RTagNode*   getNext();
351        RNode*      get(int idx, int length);
352        void        set(RNode*);
353        void        print();
354};
355
356
357/*
358========================================================================
359class RTagList(lists of RuleOld tags, i.e. first elements of a given index)
360========================================================================
361*/
362class RTagList {
363    private:
364        RTagNode*   first;
365        int         length;
366    public:
367                RTagList();
368                RTagList(RNode* r);
369                ~RTagList();
370        // declaration with first as parameter in LTagNode due to sorting of LTagList
371        void    insert(RNode* r);
372        RNode*  getFirst();
373        RNode*  get(int idx);
374        void    setFirst(RNode* r);
375        void    print();
376        int     getLength();
377};
378#endif
379#endif
Note: See TracBrowser for help on using the repository browser.