source: git/kernel/lists.cc @ 2f2bb21

spielwiese
Last change on this file since 2f2bb21 was 71f00c5, checked in by Christian Eder, 15 years ago
lists updated git-svn-id: file:///usr/local/Singular/svn/trunk@11273 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 2.7 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 "lpolynomial.h"
19#include "lists.h"
20
21/*
22====================================
23functions working on the class LNode
24====================================
25*/
26
27// generating new list elements in the labeled / classical polynomial / LNode view
28LNode::LNode(LPoly* lp) {
29    data = lp;
30    next = NULL;
31}
32       
33LNode::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       
40LNode::LNode(LNode* ln) {
41    data = ln->getLPoly();
42    next = ln->getNext();
43}
44       
45LNode::~LNode() {
46    delete next;
47    delete data;   
48}
49       
50// append new elements to the list from the labeled / classical polynomial view
51LNode* LNode::append(LPoly* lp) {
52    LNode* new_element = new LNode(lp);
53    next = new_element;
54    return new_element;
55}
56       
57LNode* 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
64LNode* LNode::getNext() {
65    return next;
66}
67       
68// get the LPoly* out of LNode*
69LPoly* LNode::getLPoly() {
70    return data;
71}
72
73// get the address of the polynomial part of LPoly* of LNode*
74poly* 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
79bool 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
90LNode* LNode::operator++() {
91    LNode* temp= new LNode(this);
92    return temp->getNext();
93}
94
95
96
97/*
98====================================
99functions working on the class LList
100====================================
101*/
102
103LList::LList(LPoly* lp) {
104    first   = new LNode(lp);
105    last    = first;
106    length  = 1;
107}
108
109LList::LList(poly* t,long* i,poly* p) {
110    first   = new LNode(t,i,p);
111    last    = first;
112    length  = 1;
113} 
114
115LList::~LList() {
116    delete first;
117}
118
119void LList::append(LPoly* lp) {
120    last = last->append(lp);
121    length++;
122}
123
124void LList::append(poly* t,long* i, poly* p) {
125    last = last->append(t,i,p);
126    length++;
127}
128
129bool LList::polyTest(poly* p) {
130    return first->polyTest(p);
131}
132
133long LList::getLength() const {
134    return length;
135}
136
137LNode* LList::getFirst() {
138    return first;
139}
140
141LNode* LList::getLast() {
142    return last;
143}
144#endif
Note: See TracBrowser for help on using the repository browser.