
#include <Entities/EntityView.h>
#include "utility.h"

EntityView::EntityView(EntityIndex start, EntityIndex size)
	: m_start(start)
	, m_size(size)
{

}


//non-const iterator
EntityViewIterator::EntityViewIterator(EntityIndex index)
	: m_currentEntity(index)
{

}

EntityViewIterator& EntityViewIterator::operator++()
{
	m_currentEntity++;
	return *this;
}

EntityViewIterator EntityViewIterator::operator++(int)
{
	m_currentEntity++;
	return m_currentEntity - 1;
}

EntityViewIterator& EntityViewIterator::operator--()
{
	m_currentEntity--;
	return *this;
}

EntityViewIterator EntityViewIterator::operator--(int)
{
	m_currentEntity--;
	return m_currentEntity + 1;
}

Entity EntityViewIterator::operator*()
{
	return m_currentEntity;
}

Entity EntityViewIterator::operator[](int index)
{
	return m_currentEntity + index;
}

bool EntityViewIterator::operator==(EntityViewIterator other)
{
	return m_currentEntity == other.m_currentEntity;
}

bool EntityViewIterator::operator!=(EntityViewIterator other)
{
	return m_currentEntity != other.m_currentEntity;
}

//const iterator
EntityViewConstIterator::EntityViewConstIterator(EntityIndex index)
	: m_currentEntity(index)
{

}

EntityViewConstIterator& EntityViewConstIterator::operator++()
{
	m_currentEntity++;
	return *this;
}

EntityViewConstIterator EntityViewConstIterator::operator++(int)
{
	m_currentEntity++;
	return m_currentEntity - 1;
}

EntityViewConstIterator& EntityViewConstIterator::operator--()
{
	m_currentEntity--;
	return *this;
}

EntityViewConstIterator EntityViewConstIterator::operator--(int)
{
	m_currentEntity--;
	return m_currentEntity + 1;
}

const Entity EntityViewConstIterator::operator*()
{
	return m_currentEntity;
}

const Entity EntityViewConstIterator::operator[](int index)
{
	return m_currentEntity + index;
}

bool EntityViewConstIterator::operator==(EntityViewConstIterator other)
{
	return m_currentEntity == other.m_currentEntity;
}

bool EntityViewConstIterator::operator!=(EntityViewConstIterator other)
{
	return m_currentEntity != other.m_currentEntity;
}