<commit_before>#pragma once

#include "Project.h"
#include "utils.h"

namespace aBuild {

	class PackageURL {
	private:
		std::string name;
		std::string url;
		std::string branch;
		std::string path;
	public:
		PackageURL()
			: name {"_"}
			, path {"."} {
		}
		auto getName() const -> std::string const& {
			return name;
		}
		auto getURL() const -> std::string const& {
			return url;
		}
		auto getBranch() const -> std::string const& {
			return branch;
		}
		auto getPath() const -> std::string const& {
			return path;
		}
		bool operator<(PackageURL const& _other) const {
			return name < _other.name;
		}
		bool operator==(PackageURL const& _other) const {
			return name == _other.name;
		}
		void serialize(jsonSerializer::Node& node) {
			node["name"]   % name;
			node["url"]    % url;
			node["branch"] % branch;
			path = "packages/"+name;
		}
	};

	using ExtDependencies = std::vector<PackageURL>;
	using Projects        = std::vector<Project>;

	class Package {
	private:
		std::string     name;
		PackageURL      url;
		ExtDependencies extDependencies;
		Projects        projects;

	public:
		Package(PackageURL const& _url)
			: url {_url} {}

		void serialize(jsonSerializer::Node& node) {
			node["name"]            % name;
			node["extDependencies"] % extDependencies;
			node["projects"]        % projects;
			for (auto& p : projects) {
				p.setPackagePath(url.getPath());<commit_msg>no need to give package name, it's extracted from url<commit_after>#pragma once

#include "Project.h"
#include "utils.h"

namespace aBuild {

	class PackageURL {
	private:
		std::string url;
		std::string branch;
		std::string path;
	public:
		PackageURL()
			: url {"_"}
			, path {"."} {
		}
		auto getName() const -> std::string {
			auto name = url;
			if (utils::isEndingWith(name, ".git")) {
				for (int i {0}; i<4; ++i) name.pop_back();
			}
			auto l = utils::explode(name, "/");
			name = l[l.size()-1];
			return name;
		}
		auto getURL() const -> std::string const& {
			return url;
		}
		auto getBranch() const -> std::string const& {
			return branch;
		}
		auto getPath() const -> std::string const& {
			return path;
		}
		bool operator<(PackageURL const& _other) const {
			return getName() < _other.getName();
		}
		bool operator==(PackageURL const& _other) const {
			return getName() == _other.getName();
		}
		void serialize(jsonSerializer::Node& node) {
			node["url"]    % url;
			node["branch"] % branch;
			path = "packages/"+getName();
		}
	};

	using ExtDependencies = std::vector<PackageURL>;
	using Projects        = std::vector<Project>;

	class Package {
	private:
		std::string     name;
		PackageURL      url;
		ExtDependencies extDependencies;
		Projects        projects;

	public:
		Package(PackageURL const& _url)
			: url {_url} {}

		void serialize(jsonSerializer::Node& node) {
			node["name"]            % name;
			node["extDependencies"] % extDependencies;
			node["projects"]        % projects;
			for (auto& p : projects) {
				p.setPackagePath(url.getPath());
{'fraction_non_alphanumeric': 0.14892205638474296, 'fraction_numerical': 0.0009950248756218905, 'mean_word_length': 3.1715076071922543, 'pattern_counts': {'":': 0, '<': 12, '<?xml version=': 0, '>': 15, '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': '2717523', 'n_tokens_mistral': 1148, 'n_tokens_neox': 991, 'n_words': 251}