source: git/kernel/lplist.cc @ fcb8022

spielwiese
Last change on this file since fcb8022 was 99d8753, checked in by Christian Eder, 15 years ago
linked list of labeled polynomials git-svn-id: file:///usr/local/Singular/svn/trunk@11208 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 2.7 KB
Line 
1/****************************************
2*  Computer Algebra System SINGULAR     *
3****************************************/
4/* $Id: lplist.cc,v 1.1 2008-11-27 17:15:55 ederc Exp $ */
5/*
6* ABSTRACT: list interface
7*/
8#include "mod2.h"
9
10#ifdef HAVE_F5
11
12#include "kutil.h"
13#include "structs.h"
14#include "omalloc.h"
15#include "polys.h"
16#include "p_polys.h"
17#include "ideals.h"
18#include "febase.h"
19#include "kstd1.h"
20#include "khstd.h"
21#include "kbuckets.h"
22#include "weight.h"
23#include "intvec.h"
24#include "pInline1.h"
25#include "lpolynomial.h"
26#include "lplist.h"
27
28
29/*
30=========================================
31=========================================
32implementation of the functions of list.h
33=========================================
34=========================================
35*/
36
37
38
39
40/*
41===========================
42insert general node in list
43===========================
44*/
45Node* GenNode::insert(LPoly* d) {
46    int ret = data->compare(*d);
47    switch(ret) {
48        case 0: case -1: {
49            next = next->insert(d);
50            return this;
51        }
52        case 1: {   
53            GenNode* newNode = new GenNode(d,this);
54            return newNode;
55        }
56    }           
57    return this;
58}
59
60/*
61========================
62get general node in list
63========================
64*/
65void GenNode::get() {
66    data->get();
67    next->get();
68}
69
70/*
71=========================
72insert first node in list
73=========================
74*/
75Node* FirstNode::insert(LPoly* d) {
76    next = next->insert(d);
77    return this;
78}
79
80/*
81===========================================================================================
82get first node in list (no element in this place, so go on to the next element in the list)
83===========================================================================================
84*/
85void FirstNode::get() {
86    next->get();
87}
88
89/*
90=======================
91insert end node in list
92=======================
93*/
94Node* EndNode::insert(LPoly* d) {
95    GenNode* data = new GenNode(d,this);
96    return data;
97}
98
99/*
100===============================================================================
101get end node in list (nothing to do, as there are no more elements in the list)
102===============================================================================
103*/
104void EndNode::get() {
105}
106
107/*
108=========================
109insert an element in list
110=========================
111*/
112void LpList::insert(LPoly* d) {
113   start->insert(d);
114   // there is no return value also we get the address of the new element in the list
115   // returning this value in the other insert functions is due to their virtual
116   // declaration in the base class Node
117}
118
119/*
120==============================
121get all elements from the list
122==============================
123*/
124void LpList::get() {
125    start->get();
126}
127
128#endif
Note: See TracBrowser for help on using the repository browser.