<commit_before>
#include <iostream>
#include <memory>
#include <stdio.h>
#include <string>

#include "SDL2/SDL.h"

#include "component.h"
#include "entity.h"
#include "renderer.h"

namespace aronnax {

Entity::Entity(Components components):
  components_(components)
  { }

Entity::Entity(Components components,
               std::shared_ptr<Renderer> renderer):
  components_(components),
  renderer_(renderer)
{ 
}

void Entity::update(const uint32_t dt)
{
  for (unsigned int i = 0; i < components_.size(); ++i) {
    components_[i]->update(*this, dt);
  }
}

void Entity::render()
{
  for (unsigned int i = 0; i < components_.size(); ++i) {
    //std::cout << "component type: " << components_[i].getType() << "\n";
    components_[i]->render(*this);
  }
}

Renderer* Entity::getRenderer()
{
  return renderer_.get();
}

// TODO improve performance by setting on constructor and addComponent.
bool Entity::hasComponent(std::string componentType)
{
  for (unsigned int i = 0; i < components_.size(); ++i) {
    if (components_[i]->getType() == componentType) {
      return true;
    }
  }
  return false;
}

Component* Entity::getComponent(std::string componentType)
{
  for (unsigned int i = 0; i < components_.size(); ++i) {
    if (components_[i]->getType() == componentType) {
      return components_[i];
    }
  }
  exit(1);
}

}
<commit_msg>Removed debug statement<commit_after>
#include <iostream>
#include <memory>
#include <stdio.h>
#include <string>

#include "SDL2/SDL.h"

#include "component.h"
#include "entity.h"
#include "renderer.h"

namespace aronnax {

Entity::Entity(Components components):
  components_(components)
  { }

Entity::Entity(Components components,
               std::shared_ptr<Renderer> renderer):
  components_(components),
  renderer_(renderer)
{ 
}

void Entity::update(const uint32_t dt)
{
  for (unsigned int i = 0; i < components_.size(); ++i) {
    components_[i]->update(*this, dt);
  }
}

void Entity::render()
{
  for (unsigned int i = 0; i < components_.size(); ++i) {
    components_[i]->render(*this);
  }
}

Renderer* Entity::getRenderer()
{
  return renderer_.get();
}

// TODO improve performance by setting on constructor and addComponent.
bool Entity::hasComponent(std::string componentType)
{
  for (unsigned int i = 0; i < components_.size(); ++i) {
    if (components_[i]->getType() == componentType) {
      return true;
    }
  }
  return false;
}

Component* Entity::getComponent(std::string componentType)
{
  for (unsigned int i = 0; i < components_.size(); ++i) {
    if (components_[i]->getType() == componentType) {
      return components_[i];
    }
  }
  exit(1);
}

}

{'fraction_non_alphanumeric': 0.16357440363498674, 'fraction_numerical': 0.00605831124574025, 'mean_word_length': 4.061302681992337, 'pattern_counts': {'":': 0, '<': 27, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7442995', 'n_tokens_mistral': 875, 'n_tokens_neox': 867, 'n_words': 209}