1 | /**************************************** |
---|
2 | * Computer Algebra System SINGULAR * |
---|
3 | ****************************************/ |
---|
4 | /* $Id: lists.h,v 1.3 2009-01-15 17:44:24 ederc Exp $ */ |
---|
5 | /* |
---|
6 | * ABSTRACT: list interface |
---|
7 | */ |
---|
8 | #include "lpolynomial.h" |
---|
9 | #ifndef LISTS_HEADER |
---|
10 | #define LISTS_HEADER |
---|
11 | |
---|
12 | #ifdef HAVE_F5 |
---|
13 | /* |
---|
14 | ============================ |
---|
15 | ============================ |
---|
16 | classes for lists used in F5 |
---|
17 | ============================ |
---|
18 | ============================ |
---|
19 | */ |
---|
20 | class LNode; |
---|
21 | class LList; |
---|
22 | class PrevNode; |
---|
23 | class PrevList; |
---|
24 | class CNode; |
---|
25 | class CList; |
---|
26 | |
---|
27 | |
---|
28 | /* |
---|
29 | ======================================= |
---|
30 | LNode class (nodes for lists of LPolys) |
---|
31 | ======================================= |
---|
32 | */ |
---|
33 | class LNode { |
---|
34 | private: |
---|
35 | LPoly* data; |
---|
36 | LNode* next; |
---|
37 | public: |
---|
38 | // generating new list elements from the labeled / classical polynomial view |
---|
39 | LNode(LPoly* lp); |
---|
40 | LNode(poly* t, int* i, poly* p); |
---|
41 | LNode(LNode* ln); |
---|
42 | ~LNode(); |
---|
43 | // append new elements to the list from the labeled / classical polynomial view |
---|
44 | LNode* insert(LPoly* lp); |
---|
45 | LNode* insert(poly* t, int* i, poly* p); |
---|
46 | // get next from current LNode |
---|
47 | LNode* getNext(); |
---|
48 | |
---|
49 | // get the LPoly* out of LNode* |
---|
50 | LPoly* getLPoly(); |
---|
51 | // get the address of the polynomial part of LPoly* of LNode* |
---|
52 | poly* getPoly(); |
---|
53 | // test if for any list element the polynomial part of the data is equal to *p |
---|
54 | bool polyTest(poly* p); |
---|
55 | }; |
---|
56 | |
---|
57 | |
---|
58 | /* |
---|
59 | ============================ |
---|
60 | class LList(lists of LPolys) |
---|
61 | ============================ |
---|
62 | */ |
---|
63 | class LList { |
---|
64 | private: |
---|
65 | LNode* first; |
---|
66 | int length; |
---|
67 | public: |
---|
68 | LList(LPoly* lp); |
---|
69 | LList(poly* t,int* i,poly* p); |
---|
70 | ~LList(); |
---|
71 | void insert(LPoly* lp); |
---|
72 | // insertion in front of the list |
---|
73 | void insert(poly* t,int* i, poly* p); |
---|
74 | bool polyTest(poly* p); |
---|
75 | int getLength() const; |
---|
76 | LNode* getFirst(); |
---|
77 | }; |
---|
78 | |
---|
79 | |
---|
80 | /* |
---|
81 | ============================================= |
---|
82 | PrevNode class (nodes for lists of gPrevLast) |
---|
83 | ============================================= |
---|
84 | */ |
---|
85 | class PrevNode { |
---|
86 | private: |
---|
87 | LNode* data; |
---|
88 | PrevNode* next; |
---|
89 | public: |
---|
90 | PrevNode(LNode* l); |
---|
91 | ~PrevNode(); |
---|
92 | PrevNode* append(LNode* l); |
---|
93 | LNode* getLNode(); |
---|
94 | LNode* getPrevLast(int i); |
---|
95 | }; |
---|
96 | |
---|
97 | |
---|
98 | /* |
---|
99 | ==================================================== |
---|
100 | class PrevList(lists of last node elements in gPrev) |
---|
101 | ==================================================== |
---|
102 | */ |
---|
103 | class PrevList { |
---|
104 | private: |
---|
105 | PrevNode* first; |
---|
106 | PrevNode* last; |
---|
107 | public: |
---|
108 | PrevList(LNode* l); |
---|
109 | ~PrevList(); |
---|
110 | void append(LNode* l); |
---|
111 | LNode* getPrevLast(int i); |
---|
112 | }; |
---|
113 | |
---|
114 | |
---|
115 | /* |
---|
116 | ======================================= |
---|
117 | CNode class (nodes for lists of CPairs) |
---|
118 | ======================================= |
---|
119 | */ |
---|
120 | class CNode { |
---|
121 | private: |
---|
122 | CPair* data; |
---|
123 | CNode* next; |
---|
124 | public: |
---|
125 | CNode(CPair* c); |
---|
126 | ~CNode(); |
---|
127 | CNode* insert(CPair* c); |
---|
128 | CNode* getLPoly() const; |
---|
129 | }; |
---|
130 | |
---|
131 | |
---|
132 | /* |
---|
133 | ============================= |
---|
134 | class CPList(lists of CPairs) |
---|
135 | ============================= |
---|
136 | */ |
---|
137 | class CList { |
---|
138 | private: |
---|
139 | CNode* first; |
---|
140 | public: |
---|
141 | CList(CPair* c); |
---|
142 | ~CList(); |
---|
143 | void insert(CPair* c); |
---|
144 | }; |
---|
145 | #endif |
---|
146 | #endif |
---|