<commit_before>#include "CompositePath.hpp"

using namespace std;
using namespace Geometry2d;
namespace Planning
{
	CompositePath::CompositePath(unique_ptr<Path> path) {
		append(std::move(path));
	}

	CompositePath::CompositePath(Path *path) {
		append(path);
	}

	void CompositePath::append(Path *path) {
		append(std::unique_ptr<Path>(path));
	}

	void CompositePath::append(unique_ptr<Path> path) {
		if (duration<std::numeric_limits<float>::infinity()) {
			float pathDuration = path->getDuration();
			if (pathDuration > 0) {
				duration += pathDuration;
				paths.push_back(std::move(path));
			} else {
				debugThrow(invalid_argument("The path passed is invalid"));
			}
		} else {
			debugThrow(runtime_error("You can't append to this path. It is already infinitely long."));
		}
	}

	bool CompositePath::evaluate(float t, Point &targetPosOut, Point &targetVelOut) const 
	{
		if (paths.empty()) {
			return false;
		}
		if (t<0) {
			return false;
		}
		for (const std::unique_ptr<Path> &path: paths)
		{
			float timeLength = path->getDuration();
			t -= timeLength;
			if (t<=0 || timeLength == -1) {
				t += timeLength;
				path->evaluate(t, targetPosOut, targetVelOut);<commit_msg>Add a space for better readability<commit_after>#include "CompositePath.hpp"

using namespace std;
using namespace Geometry2d;
namespace Planning
{
	CompositePath::CompositePath(unique_ptr<Path> path) {
		append(std::move(path));
	}

	CompositePath::CompositePath(Path *path) {
		append(path);
	}

	void CompositePath::append(Path *path) {
		append(std::unique_ptr<Path>(path));
	}

	void CompositePath::append(unique_ptr<Path> path) {
		if (duration < std::numeric_limits<float>::infinity()) {
			float pathDuration = path->getDuration();
			if (pathDuration > 0) {
				duration += pathDuration;
				paths.push_back(std::move(path));
			} else {
				debugThrow(invalid_argument("The path passed is invalid"));
			}
		} else {
			debugThrow(runtime_error("You can't append to this path. It is already infinitely long."));
		}
	}

	bool CompositePath::evaluate(float t, Point &targetPosOut, Point &targetVelOut) const 
	{
		if (paths.empty()) {
			return false;
		}
		if (t<0) {
			return false;
		}
		for (const std::unique_ptr<Path> &path: paths)
		{
			float timeLength = path->getDuration();
			t -= timeLength;
			if (t<=0 || timeLength == -1) {
				t += timeLength;
				path->evaluate(t, targetPosOut, targetVelOut);
{'fraction_non_alphanumeric': 0.1455146754857379, 'fraction_numerical': 0.00413393964448119, 'mean_word_length': 4.45045045045045, 'pattern_counts': {'":': 0, '<': 19, '<?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': '3725747', 'n_tokens_mistral': 917, 'n_tokens_neox': 798, 'n_words': 179}