Loading...
Searching...
No Matches
cf_iter.cc
Go to the documentation of this file.
/* emacs edit mode for this file is -*- C++ -*- */
#include "config.h"
#include "cf_assert.h"
#include "cf_defs.h"
#include "cf_iter.h"
#include "int_cf.h"
#include "int_poly.h"
CFIterator::CFIterator()
{
data = 0; cursor = 0;
ispoly = false; hasterms = false;
}
CFIterator::CFIterator( const CFIterator & i )
{
data = i.data;
cursor = i.cursor;
ispoly = i.ispoly;
hasterms = i.hasterms;
}
CFIterator::CFIterator( const CanonicalForm & f )
{
if ( f.inBaseDomain() || f.inQuotDomain() )
{
data = f; cursor = 0;
ispoly = false; hasterms = true;
}
else
{
data = f;
cursor = ((InternalPoly*)(f.value))->firstTerm;
ispoly = true; hasterms = true;
}
}
CFIterator::CFIterator( const CanonicalForm & f, const Variable & v )
{
ASSERT( !f.inQuotDomain(), "illegal iterator" );
ASSERT( v.level() > 0, "illegal iterator" );
if ( f.inBaseDomain() )
{
data = f; cursor = 0;
ispoly = false; hasterms = true;
}
else
{
if ( f.mvar() == v )
{
data = f;
cursor = ((InternalPoly*)(f.value))->firstTerm;
ispoly = true; hasterms = true;
}
else if ( v > f.mvar() )
{
data = f; cursor = 0;
ispoly = false; hasterms = true;
}
else
{
data = swapvar( f, v, f.mvar().next() );
if ( data.mvar() == f.mvar().next() )
{
cursor = ((InternalPoly*)(data.value))->firstTerm;
ispoly = true; hasterms = true;
}
else
{
cursor = 0;
ispoly = false; hasterms = true;
}
}
}
}
CFIterator::~CFIterator()
{
data = 0; cursor = 0;
}
CFIterator&
CFIterator::operator= ( const CFIterator & i )
{
if ( this != &i )
{
data = i.data;
cursor = i.cursor;
ispoly = i.ispoly;
hasterms = i.hasterms;
}
return *this;
}
CFIterator&
CFIterator::operator= ( const CanonicalForm & f )
{
if ( f.inBaseDomain() || f.inQuotDomain() )
{
data = f; cursor = 0;
ispoly = false; hasterms = true;
}
else
{
data = f;
cursor = ((InternalPoly*)(f.value))->firstTerm;
ispoly = true; hasterms = true;
}
return *this;
}
i
int i
Definition cfEzgcd.cc:132
cf_assert.h
assertions for Factory
ASSERT
#define ASSERT(expression, message)
Definition cf_assert.h:99
cf_defs.h
factory switches.
cf_iter.h
Iterators for CanonicalForm's.
f
FILE * f
Definition checklibs.c:9
CFIterator
class to iterate through CanonicalForm's
Definition cf_iter.h:44
CFIterator::ispoly
bool ispoly
Definition cf_iter.h:48
CFIterator::CFIterator
CFIterator()
Definition cf_iter.cc:15
CFIterator::~CFIterator
~CFIterator()
Definition cf_iter.cc:83
CFIterator::data
CanonicalForm data
Definition cf_iter.h:46
CFIterator::cursor
termList cursor
Definition cf_iter.h:47
CFIterator::hasterms
bool hasterms
Definition cf_iter.h:48
CFIterator::operator=
CFIterator & operator=(const CFIterator &)
Definition cf_iter.cc:89
CanonicalForm
factory's main class
Definition canonicalform.h:86
InternalPoly
factory's class for polynomials
Definition int_poly.h:71
Variable
factory's class for variables
Definition factory.h:127
v
const Variable & v
< [in] a sqrfree bivariate poly
Definition facBivar.h:39
swapvar
CanonicalForm FACTORY_PUBLIC swapvar(const CanonicalForm &, const Variable &, const Variable &)
swapvar() - swap variables x1 and x2 in f.
Definition cf_ops.cc:168
int_cf.h
Factory's internal CanonicalForm's.
int_poly.h
Factory's internal polynomials.