<commit_before>#include "gridnav.hpp"
#include "../search/closedlist.hpp"
#include <cassert>

template<typename Node> struct ClosedEntry<Node, GridNav> { };

template<typename Ops, typename Node> struct ClosedList<Ops, Node, GridNav> {
	typedef GridNav::PackedState PackedState;

	ClosedList(unsigned long szhint) : len(0), cap(szhint) {
		nodes = new Node*[cap];

		for (unsigned int i = 0; i < cap; i++)
			nodes[i] = NULL;
	}

	~ClosedList() {
		delete[] nodes;
	}

	void init(GridNav &d) {
		len = d.map->sz;
		if (cap >= len)
			return;

		cap = len;

		delete[] nodes;
		nodes = new Node*[cap];

		for (unsigned int i = 0; i < cap; i++)
			nodes[i] = NULL;
	}

	void clear() {
		for (unsigned int i = 0; i < cap; i++)
			nodes[i] = NULL;
	}

	void add(Node *n) { add(n, Ops::key(n).loc); }

	void add(Node *n, unsigned long h) {
		assert(h < len);
		nodes[h] = n;
	}

	Node *find(PackedState &k) { return find(k, k.loc); }

	Node *find(PackedState &k, unsigned long h) {
		assert(h < len);
		return nodes[h];
	}

	void prstats(FILE *out, const char *prefix) {
		dfpair(out, "closed list type", "%s", "array");
	}

private:

	unsigned long len, cap;
	Node **nodes;
};<commit_msg>made destructor virtual and changed private -> protected<commit_after>#include "gridnav.hpp"
#include "../search/closedlist.hpp"
#include <cassert>

template<typename Node> struct ClosedEntry<Node, GridNav> { };

template<typename Ops, typename Node> struct ClosedList<Ops, Node, GridNav> {
	typedef GridNav::PackedState PackedState;

	ClosedList(unsigned long szhint) : len(0), cap(szhint) {
		nodes = new Node*[cap];

		for (unsigned int i = 0; i < cap; i++)
			nodes[i] = NULL;
	}

	virtual ~ClosedList() {
		delete[] nodes;
	}

	void init(GridNav &d) {
		len = d.map->sz;
		if (cap >= len)
			return;

		cap = len;

		delete[] nodes;
		nodes = new Node*[cap];

		for (unsigned int i = 0; i < cap; i++)
			nodes[i] = NULL;
	}

	void clear() {
		for (unsigned int i = 0; i < cap; i++)
			nodes[i] = NULL;
	}

	void add(Node *n) { add(n, Ops::key(n).loc); }

	void add(Node *n, unsigned long h) {
		assert(h < len);
		nodes[h] = n;
	}

	Node *find(PackedState &k) { return find(k, k.loc); }

	Node *find(PackedState &k, unsigned long h) {
		assert(h < len);
		return nodes[h];
	}

	void prstats(FILE *out, const char *prefix) {
		dfpair(out, "closed list type", "%s", "array");
	}

protected:

	unsigned long len, cap;
	Node **nodes;
};
{'fraction_non_alphanumeric': 0.17100371747211895, 'fraction_numerical': 0.003304419661296985, 'mean_word_length': 3.6045627376425857, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 18, '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': '4295495', 'n_tokens_mistral': 1010, 'n_tokens_neox': 921, 'n_words': 269}