1 /**************************************** 2 * Computer Algebra System SINGULAR * 3 ****************************************/ 4 /* 5 * ABSTRACT: list interface 6 */ 7 8 9 10 #include <kernel/mod2.h> 11 12 #ifdef HAVE_F5 13 14 #include <kernel/GBEngine/kutil.h> 15 #include <kernel/structs.h> 16 #include <omalloc/omalloc.h> 17 #include <kernel/polys.h> 18 #include <polys/monomials/p_polys.h> 19 #include <kernel/ideals.h> 20 #include <kernel/GBEngine/kstd1.h> 21 #include <kernel/GBEngine/khstd.h> 22 #include <polys/kbuckets.h> 23 #include <polys/weight.h> 24 #include <misc/intvec.h> 25 #include <kernel/polys.h> 26 #include <kernel/lpolynomial.h> 27 #include <kernel/lplist.h> 28 29 30 /* 31 ========================================= 32 ========================================= 33 implementation of the functions of list.h 34 ========================================= 35 ========================================= 36 */ 37 38 39 40 41 /* 42 =========================== 43 insert general node in list 44 =========================== 45 */ insert(LPoly * d)46Node* GenNode::insert(LPoly* d) { 47 int ret = data->compare(*d); 48 switch(ret) { 49 case 0: case -1: { 50 next = next->insert(d); 51 return this; 52 } 53 case 1: { 54 GenNode* newNode = new GenNode(d,this); 55 return newNode; 56 } 57 } 58 return this; 59 } 60 61 /* 62 ======================== 63 get general node in list 64 ======================== 65 */ get()66void GenNode::get() { 67 data->get(); 68 next->get(); 69 } 70 71 /* 72 ========================= 73 insert first node in list 74 ========================= 75 */ insert(LPoly * d)76Node* FirstNode::insert(LPoly* d) { 77 next = next->insert(d); 78 return this; 79 } 80 81 /* 82 =========================================================================================== 83 get first node in list (no element in this place, so go on to the next element in the list) 84 =========================================================================================== 85 */ get()86void FirstNode::get() { 87 next->get(); 88 } 89 90 /* 91 ======================= 92 insert end node in list 93 ======================= 94 */ insert(LPoly * d)95Node* EndNode::insert(LPoly* d) { 96 GenNode* data = new GenNode(d,this); 97 return data; 98 } 99 100 /* 101 =============================================================================== 102 get end node in list (nothing to do, as there are no more elements in the list) 103 =============================================================================== 104 */ get()105void EndNode::get() { 106 } 107 108 /* 109 ========================= 110 insert an element in list 111 ========================= 112 */ insert(LPoly * d)113void LpList::insert(LPoly* d) { 114 start->insert(d); 115 // there is no return value also we get the address of the new element in the list 116 // returning this value in the other insert functions is due to their virtual 117 // declaration in the base class Node 118 } 119 120 /* 121 ============================== 122 get all elements from the list 123 ============================== 124 */ get()125void LpList::get() { 126 start->get(); 127 } 128 129 #endif 130