/*
* Author:          Patrick-Christopher Mattulat
 * Co-Author:       Claude Sonnet 4.6 (LLM)
* Company:         Lynar Studios
* E-Mail:          webmaster@lynarstudios.com
* Created:         2023-02-10
* Changed:         2026-06-23
*
* */

#include <ls-std/core/evaluator/IndexOutOfBoundsEvaluator.hpp>
#include <ls-std/core/exception/IndexOutOfBoundsException.hpp>

using ls::standard::core::IndexOutOfBoundsEvaluator;
using ls::standard::core::IndexOutOfBoundsException;
using std::move;
using std::string;

IndexOutOfBoundsEvaluator::IndexOutOfBoundsEvaluator(const size_t _index, const size_t _size) : index(_index), size(_size)
{}

IndexOutOfBoundsEvaluator::IndexOutOfBoundsEvaluator(const size_t _index, const size_t _size, string _message) : index(_index), message(::move(_message)), size(_size)
{}

IndexOutOfBoundsEvaluator::~IndexOutOfBoundsEvaluator() noexcept = default;

void IndexOutOfBoundsEvaluator::evaluate()
{
  if (this->index >= this->size)
  {
    if (this->message.empty())
    {
      throw IndexOutOfBoundsException{};
    }

    throw IndexOutOfBoundsException{this->message};
  }
}
