source: git/kernel/old.lplist.cc @ 9127cc

spielwiese
Last change on this file since 9127cc was 762407, checked in by Oleksandr Motsak <motsak@…>, 12 years ago
config.h is for sources files only FIX: config.h should only be used by source (not from inside kernel/mod2.h!) NOTE: each source file should better include mod2.h right after config.h, while headers should better not include mod2.h.
  • Property mode set to 100644
File size: 2.8 KB
Line 
1/****************************************
2*  Computer Algebra System SINGULAR     *
3****************************************/
4/* $Id$ */
5/*
6* ABSTRACT: list interface
7*/
8#include "config.h"
9#include <kernel/mod2.h>
10
11#ifdef HAVE_F5
12
13#include <kernel/kutil.h>
14#include <kernel/structs.h>
15#include <omalloc/omalloc.h>
16#include <kernel/polys.h>
17#include <polys/monomials/p_polys.h>
18#include <kernel/ideals.h>
19#include <kernel/febase.h>
20#include <kernel/kstd1.h>
21#include <kernel/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=========================================
33implementation of the functions of list.h
34=========================================
35=========================================
36*/
37
38
39
40
41/*
42===========================
43insert general node in list
44===========================
45*/
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========================
63get general node in list
64========================
65*/
66void GenNode::get() {
67    data->get();
68    next->get();
69}
70
71/*
72=========================
73insert first node in list
74=========================
75*/
76Node* FirstNode::insert(LPoly* d) {
77    next = next->insert(d);
78    return this;
79}
80
81/*
82===========================================================================================
83get first node in list (no element in this place, so go on to the next element in the list)
84===========================================================================================
85*/
86void FirstNode::get() {
87    next->get();
88}
89
90/*
91=======================
92insert end node in list
93=======================
94*/
95Node* EndNode::insert(LPoly* d) {
96    GenNode* data = new GenNode(d,this);
97    return data;
98}
99
100/*
101===============================================================================
102get end node in list (nothing to do, as there are no more elements in the list)
103===============================================================================
104*/
105void EndNode::get() {
106}
107
108/*
109=========================
110insert an element in list
111=========================
112*/
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==============================
122get all elements from the list
123==============================
124*/
125void LpList::get() {
126    start->get();
127}
128
129#endif
Note: See TracBrowser for help on using the repository browser.