15 #ifndef POLYENUMERATOR_H 16 #define POLYENUMERATOR_H 96 if (m_position == &m_prevposition_struct)
100 return (m_position !=
NULL);
160 template <
class ConverterPolicy>
170 return m_global_enumerator.
IsValid() && m_local_enumerator.
IsValid();
184 if( !m_global_enumerator.
MoveNext() )
189 poly p = ConverterPolicy::convert(m_global_enumerator.
Current());
193 m_local_enumerator.
Reset( p );
203 m_global_enumerator.
Reset();
IEnumerator< number > IPolyCoeffsEnumerator
This is the interface we use in coeffs.h for ClearDenominators and ClearContent.
poly m_poly
essentially immutable original iterable object
static poly convert(const number &n)
void Reset(poly p)
Reset this polynomial Enumerator with a different input polynomial.
const value_type & const_reference
virtual bool IsValid() const
Current position is inside the collection (not -1 or past the end)
CBasePolyEnumerator(poly p=NULL)
This enumerator is an empty polynomial by default.
virtual bool MoveNext()
Advances the position to the next term of the polynomial. returns true if the position marker was suc...
virtual void Reset()
Sets the enumerator to its initial position: -1, which is before the first element in the collection...
virtual IPolyCoeffsEnumerator::const_reference Current() const
Gets the current element in the collection (read only).
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
CRecursivePolyCoeffsEnumerator(IPolyCoeffsEnumerator &itr)
NOTE: carefull: don't destruct the input enumerator before doing it with this one... this also changes the original IPolyCoeffsEnumerator& itr!
Abstract API for enumerators.
virtual IPolyCoeffsEnumerator::const_reference Current() const
Gets the current element in the collection (read only).
virtual IPolyCoeffsEnumerator::reference Current()
Gets the current element in the collection (read and write).
virtual void Reset()=0
Sets the enumerator to its initial position: -1, which is before the first element in the collection...
This is a polynomial enumerator for simple iteration over coefficients of polynomials.
virtual bool MoveNext()
Advances the enumerator to the next element of the collection. returns true if the enumerator was suc...
Templated enumerator interface for simple iteration over a generic collection of T's.
virtual reference Current()=0
Gets the current element in the collection (read and write).
virtual bool IsValid() const =0
Current position is inside the collection (not -1 or past the end)
go into polynomials over an alg. extension recursively
CBasePolyEnumerator m_local_enumerator
iterates the current coeff. of m_global_enumerator
virtual void Reset()
Sets the position marker to the leading term.
virtual bool MoveNext()=0
Advances the enumerator to the next element of the collection. returns true if the enumerator was suc...
poly m_position
current position in the iterable object
Base enumerator interface for simple iteration over a generic collection.
static const spolyrec m_prevposition_struct
tag for "-1" position
virtual IPolyCoeffsEnumerator::reference Current()
Gets the current element in the collection (read and write).
IPolyCoeffsEnumerator & m_global_enumerator
iterates the input polynomial
Base polynomial enumerator for simple iteration over terms of polynomials.
CPolyCoeffsEnumerator(poly p)
virtual bool IsValid() const
Current position is inside the collection (not -1 or past the end)