cf_iter.cc
Go to the documentation of this file.
1 /* emacs edit mode for this file is -*- C++ -*- */
2 
3 
4 #include "config.h"
5 
6 
7 #include "cf_assert.h"
8 
9 #include "cf_defs.h"
10 #include "cf_iter.h"
11 #include "int_cf.h"
12 #include "int_poly.h"
13 
14 
16 {
17  data = 0; cursor = 0;
18  ispoly = false; hasterms = false;
19 }
20 
22 {
23  data = i.data;
24  cursor = i.cursor;
25  ispoly = i.ispoly;
26  hasterms = i.hasterms;
27 }
28 
30 {
31  if ( f.inBaseDomain() || f.inQuotDomain() )
32  {
33  data = f; cursor = 0;
34  ispoly = false; hasterms = true;
35  }
36  else
37  {
38  data = f;
39  cursor = ((InternalPoly*)(f.value))->firstTerm;
40  ispoly = true; hasterms = true;
41  }
42 }
43 
45 {
46  ASSERT( !f.inQuotDomain(), "illegal iterator" );
47  ASSERT( v.level() > 0, "illegal iterator" );
48  if ( f.inBaseDomain() )
49  {
50  data = f; cursor = 0;
51  ispoly = false; hasterms = true;
52  }
53  else
54  {
55  if ( f.mvar() == v )
56  {
57  data = f;
58  cursor = ((InternalPoly*)(f.value))->firstTerm;
59  ispoly = true; hasterms = true;
60  }
61  else if ( v > f.mvar() )
62  {
63  data = f; cursor = 0;
64  ispoly = false; hasterms = true;
65  }
66  else
67  {
68  data = swapvar( f, v, f.mvar().next() );
69  if ( data.mvar() == f.mvar().next() )
70  {
71  cursor = ((InternalPoly*)(data.value))->firstTerm;
72  ispoly = true; hasterms = true;
73  }
74  else
75  {
76  cursor = 0;
77  ispoly = false; hasterms = true;
78  }
79  }
80  }
81 }
82 
84 {
85  data = 0; cursor = 0;
86 }
87 
90 {
91  if ( this != &i )
92  {
93  data = i.data;
94  cursor = i.cursor;
95  ispoly = i.ispoly;
96  hasterms = i.hasterms;
97  }
98  return *this;
99 }
100 
101 CFIterator&
103 {
104  if ( f.inBaseDomain() || f.inQuotDomain() )
105  {
106  data = f; cursor = 0;
107  ispoly = false; hasterms = true;
108  }
109  else
110  {
111  data = f;
112  cursor = ((InternalPoly*)(f.value))->firstTerm;
113  ispoly = true; hasterms = true;
114  }
115  return *this;
116 }
termList cursor
Definition: cf_iter.h:47
factory's class for variables
Definition: factory.h:115
factory's main class
Definition: canonicalform.h:75
assertions for Factory
CFIterator & operator=(const CFIterator &)
Definition: cf_iter.cc:89
bool ispoly
Definition: cf_iter.h:48
CanonicalForm swapvar(const CanonicalForm &, const Variable &, const Variable &)
swapvar() - swap variables x1 and x2 in f.
Definition: cf_ops.cc:168
int level() const
Definition: factory.h:132
~CFIterator()
Definition: cf_iter.cc:83
factory's class for polynomials
Definition: int_poly.h:71
Iterators for CanonicalForm's.
FILE * f
Definition: checklibs.c:9
int i
Definition: cfEzgcd.cc:123
factory switches.
Variable mvar() const
mvar() returns the main variable of CO or Variable() if CO is in a base domain.
InternalCF * value
Definition: canonicalform.h:81
bool hasterms
Definition: cf_iter.h:48
CanonicalForm data
Definition: cf_iter.h:46
class to iterate through CanonicalForm's
Definition: cf_iter.h:44
Factory's internal polynomials.
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:37
CFIterator()
Definition: cf_iter.cc:15
Factory&#39;s internal CanonicalForm&#39;s.
#define ASSERT(expression, message)
Definition: cf_assert.h:99