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 "lpolynomial.h" |
---|
19 | #include "lists.h" |
---|
20 | |
---|
21 | /* |
---|
22 | ==================================== |
---|
23 | functions working on the class LNode |
---|
24 | ==================================== |
---|
25 | */ |
---|
26 | |
---|
27 | // generating new list elements in the labeled / classical polynomial / LNode view |
---|
28 | LNode::LNode(LPoly* lp) { |
---|
29 | data = lp; |
---|
30 | next = NULL; |
---|
31 | } |
---|
32 | |
---|
33 | LNode::LNode(poly* t, long* i, poly* p) { |
---|
34 | LPoly* lp = new LPoly(t,i,p); |
---|
35 | data = lp; |
---|
36 | Print("Index angelegt? %ld\n",*(data->getIndex())); |
---|
37 | next = NULL; |
---|
38 | } |
---|
39 | |
---|
40 | LNode::LNode(LNode* ln) { |
---|
41 | data = ln->getLPoly(); |
---|
42 | next = ln->getNext(); |
---|
43 | } |
---|
44 | |
---|
45 | LNode::~LNode() { |
---|
46 | delete next; |
---|
47 | delete data; |
---|
48 | } |
---|
49 | |
---|
50 | // append new elements to the list from the labeled / classical polynomial view |
---|
51 | LNode* LNode::append(LPoly* lp) { |
---|
52 | LNode* new_element = new LNode(lp); |
---|
53 | next = new_element; |
---|
54 | return new_element; |
---|
55 | } |
---|
56 | |
---|
57 | LNode* LNode::append(poly* t, long* i, poly* p) { |
---|
58 | LNode* new_element = new LNode(t,i,p); |
---|
59 | next = new_element; |
---|
60 | return new_element; |
---|
61 | } |
---|
62 | |
---|
63 | // get next from current LNode |
---|
64 | LNode* LNode::getNext() { |
---|
65 | return next; |
---|
66 | } |
---|
67 | |
---|
68 | // get the LPoly* out of LNode* |
---|
69 | LPoly* LNode::getLPoly() { |
---|
70 | return data; |
---|
71 | } |
---|
72 | |
---|
73 | // get the address of the polynomial part of LPoly* of LNode* |
---|
74 | poly* LNode::getPoly() { |
---|
75 | return data->getPoly(); |
---|
76 | } |
---|
77 | |
---|
78 | // test if for any list element the polynomial part of the data is equal to *p |
---|
79 | bool LNode:polyTest(poly* p) { |
---|
80 | LNode* temp = new LNode(this); |
---|
81 | while(NULL != temp) { |
---|
82 | if(pComparePolys(*(temp->getPoly()),*p)) { |
---|
83 | return 1; |
---|
84 | } |
---|
85 | temp = temp->next; |
---|
86 | } |
---|
87 | return 0; |
---|
88 | } |
---|
89 | |
---|
90 | LNode* LNode::operator++() { |
---|
91 | LNode* temp= new LNode(this); |
---|
92 | return temp->getNext(); |
---|
93 | } |
---|
94 | |
---|
95 | |
---|
96 | |
---|
97 | /* |
---|
98 | ==================================== |
---|
99 | functions working on the class LList |
---|
100 | ==================================== |
---|
101 | */ |
---|
102 | |
---|
103 | LList::LList(LPoly* lp) { |
---|
104 | first = new LNode(lp); |
---|
105 | last = first; |
---|
106 | length = 1; |
---|
107 | } |
---|
108 | |
---|
109 | LList::LList(poly* t,long* i,poly* p) { |
---|
110 | first = new LNode(t,i,p); |
---|
111 | last = first; |
---|
112 | length = 1; |
---|
113 | } |
---|
114 | |
---|
115 | LList::~LList() { |
---|
116 | delete first; |
---|
117 | } |
---|
118 | |
---|
119 | void LList::append(LPoly* lp) { |
---|
120 | last = last->append(lp); |
---|
121 | length++; |
---|
122 | } |
---|
123 | |
---|
124 | void LList::append(poly* t,long* i, poly* p) { |
---|
125 | last = last->append(t,i,p); |
---|
126 | length++; |
---|
127 | } |
---|
128 | |
---|
129 | bool LList::polyTest(poly* p) { |
---|
130 | return first->polyTest(p); |
---|
131 | } |
---|
132 | |
---|
133 | long LList::getLength() const { |
---|
134 | return length; |
---|
135 | } |
---|
136 | |
---|
137 | LNode* LList::getFirst() { |
---|
138 | return first; |
---|
139 | } |
---|
140 | |
---|
141 | LNode* LList::getLast() { |
---|
142 | return last; |
---|
143 | } |
---|
144 | #endif |
---|