source: git/kernel/lists.h @ 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: 3.6 KB
Line 
1/****************************************
2*  Computer Algebra System SINGULAR     *
3****************************************/
4/* $Id: lists.h,v 1.2 2008-12-27 13:50:05 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=======================
17=======================
18linked lists for LPolys
19=======================
20=======================
21*/
22
23
24/*
25===========================
26classes for lists of LPolys
27===========================
28*/
29class LNode;
30class LList;
31
32
33/*
34=======================================
35LNode class (nodes for lists of LPolys)
36=======================================
37*/
38class LNode {
39    private:
40        LPoly* data;
41        LNode* next;
42    public:
43        // generating new list elements from the labeled / classical polynomial view
44                LNode(LPoly* lp);
45                LNode(poly* t, long* i, poly* p);
46                LNode(LNode* ln);
47                ~LNode();
48        // append new elements to the list from the labeled / classical polynomial view
49        LNode*  append(LPoly* lp);
50        LNode*  append(poly* t, long* i, poly* p);
51        // get next from current LNode
52        LNode*  getNext();
53       
54        // get the LPoly* out of LNode*
55        LPoly*  getLPoly();
56        // get the address of the polynomial part of LPoly* of LNode*
57        poly*   getPoly();
58        // test if for any list element the polynomial part of the data is equal to *p
59        bool    polyTest(poly* p);
60        LNode*  operator++();
61};
62
63
64/*
65============================
66class LList(lists of LPolys)
67============================
68*/
69class LList {
70    private:
71        LNode*  first;
72        LNode*  last;
73        long    length;
74    public:
75                LList(LPoly* lp);
76                LList(poly* t,long* i,poly* p);
77                ~LList();
78        void    append(LPoly* lp);
79        void    append(poly* t,long* i, poly* p);
80        bool    polyTest(poly* p);
81        long    getLength() const;
82        LNode*  getFirst();
83        LNode*  getLast();
84};
85
86
87/*
88=======================
89=======================
90linked lists for CPairs
91=======================
92=======================
93*/
94
95
96/*
97===========================
98classes for lists of CPairs
99===========================
100*/
101class CNode;
102class CList;
103
104
105/*
106=======================================
107CNode class (nodes for lists of CPairs)
108=======================================
109*/
110class CNode {
111    private:
112        LPoly* data;
113        CNode* next;
114    public:
115        CNode(LPoly* lp, CNode* n) {
116            data = lp;
117            next = n;
118        }
119        ~CNode() {
120            delete next;
121            delete data;   
122        }
123        CNode* append(LPoly* lp) {
124            CNode* new_element = new CNode(lp,NULL);
125            next = new_element;
126            return new_element;
127        }
128        LPoly* getLPoly() const {
129            return data;
130        }
131};
132
133
134/*
135=============================
136class CPList(lists of CPairs)
137=============================
138*/
139class CList {
140    private:
141        CNode*  first;
142        CNode*  last;
143        long    length;
144    public:
145        CList(LPoly* lp) {
146            first = new CNode(lp,NULL);
147            last = first;
148            length = 1;
149        }
150        ~CList() {
151            delete first;
152        }
153        void append(LPoly* lp) {
154            last = last->append(lp);
155            length++;
156        }
157        long getLength() const {
158            return length;
159        }
160        CNode* getFirst() const {
161            return first;
162        }
163        CNode* getLast() const {
164            return last;
165        }
166};
167#endif
168#endif
Note: See TracBrowser for help on using the repository browser.