#include "eir.h"

namespace goose::eir
{
    bool VecGenerator::finished() const
    {
        return ( !m_cont.repetitionTerm() && m_index == m_cont.terms().size() )
            || ( m_cont.repetitionTerm() && m_index >= m_cont.terms().size() );
    }

    bool VecGenerator::fixedPartFinished() const
    {
        return m_index >= m_cont.terms().size();
    }

    const Term& VecGenerator::operator()()
    {
        if( m_cont.repetitionTerm() && m_index >= m_cont.terms().size() )
        {
            ++m_index;
            return *m_cont.repetitionTerm();
        }

        assert( !finished() );
        return m_cont.terms()[m_index++];
    }
}
