<commit_before>#ifndef __KD_TREE_HPP_
#define __KD_TREE_HPP_

#include <string>
#include <iostream>
#include <vector>

//______________________________________________________________________________
class Point {
   public :

      // constructors
      Point();
      Point(double x, double y, double z);
      Point(const Point& other);
      bool operator==(const Point& other) const; 
      
      virtual ~Point();

      // getters
      double X() const {return fX;}
      double Y() const {return fY;}
      double Z() const {return fZ;}

      // setters
      void SetX(double x){fX=x;}
      void SetY(double y){fY=y;}
      void SetZ(double z){fZ=z;}

      std::string ToString() const;
      double DistanceTo(const Point& point) const;
      double SquaredDistanceTo(const Point& point) const;
      
   private:
      double fX,fY,fZ;
};

class sortX {
	public:
	bool operator() (Point *a, Point *b) { return ((*a).X() < (*b).X());}
};

class sortY {
	public:
	bool operator() (Point *a, Point *b) { return ((*a).Y() < (*b).Y());}
};

class sortZ {
	public:
	bool operator() (Point *a, Point *b) { return ((*a).Z() < (*b).Z());}
};

//______________________________________________________________________________
class KDTreeNode {
public:
   KDTreeNode();
   KDTreeNode(const KDTreeNode& other);
   virtual ~KDTreeNode();
   
   void SetDepth(int depth) {fDepth = depth;}
   void SetPoint(Point* otherPoint) {fPoint = otherPoint;}
   void SetParent(KDTreeNode* other) {fParent = other;}
   void SetLeftChild(KDTreeNode* otherLeft) {fLeft = otherLeft;}
   void SetRightChild(KDTreeNode* otherRight) {fRight = otherRight;}
   
   int GetDepth() const {return fDepth;}
   const Point& GetPoint() const {return *fPoint;}
   const KDTreeNode* GetParent() const {return fParent;}
   const KDTreeNode* GetLeftChild() const {return fLeft;}
   const KDTreeNode* GetRightChild() const {return fRight;}
   
   const KDTreeNode& FindNodeContaining(const Point& point) const;
   const KDTreeNode& CheckParentForCloserNodes(const Point& point, const KDTreeNode& best) const;
   
   void OutputGraphViz(std::ostream& out) const;
   
private:
   unsigned int fDepth;
   Point* fPoint;
   KDTreeNode *fParent;
   KDTreeNode *fLeft;
   KDTreeNode *fRight;	
   
   bool CheckOtherSideofSplittingPlane(const Point& point, const double radius) const;
   const KDTreeNode& SearchChildren(const Point& point, const KDTreeNode& currentBest) const;
   bool IsCloserToPoint(const Point& point, const KDTreeNode& currentBest) const;
};

//______________________________________________________________________________
class KDTree {
   public:
      KDTree(std::vector<Point*>& pointList);
      KDTree(const KDTree& other);
      virtual ~KDTree();
      
      const Point& NearestNeighbour(const Point& point) const;
      void OutputGraphViz(std::ostream& out) const;
      
   private:
      KDTreeNode *fRoot;
      
      KDTreeNode* BuildNode(std::vector<Point*>& pointList, KDTreeNode* parent, int depth=0);
      
};

#endif<commit_msg>Made some KDTreeNode methods private<commit_after>#ifndef __KD_TREE_HPP_
#define __KD_TREE_HPP_

#include <string>
#include <iostream>
#include <vector>

//______________________________________________________________________________
class Point {
   public :

      // constructors
      Point();
      Point(double x, double y, double z);
      Point(const Point& other);
      bool operator==(const Point& other) const; 
      
      virtual ~Point();

      // getters
      double X() const {return fX;}
      double Y() const {return fY;}
      double Z() const {return fZ;}

      // setters
      void SetX(double x){fX=x;}
      void SetY(double y){fY=y;}
      void SetZ(double z){fZ=z;}

      std::string ToString() const;
      double DistanceTo(const Point& point) const;
      double SquaredDistanceTo(const Point& point) const;
      
   private:
      double fX,fY,fZ;
};

class sortX {
	public:
	bool operator() (Point *a, Point *b) { return ((*a).X() < (*b).X());}
};

class sortY {
	public:
	bool operator() (Point *a, Point *b) { return ((*a).Y() < (*b).Y());}
};

class sortZ {
	public:
	bool operator() (Point *a, Point *b) { return ((*a).Z() < (*b).Z());}
};

//______________________________________________________________________________
class KDTreeNode {
public:
   KDTreeNode();
   KDTreeNode(const KDTreeNode& other);
   virtual ~KDTreeNode();
   
   void SetDepth(int depth) {fDepth = depth;}
   void SetPoint(Point* otherPoint) {fPoint = otherPoint;}
   void SetParent(KDTreeNode* other) {fParent = other;}
   void SetLeftChild(KDTreeNode* otherLeft) {fLeft = otherLeft;}
   void SetRightChild(KDTreeNode* otherRight) {fRight = otherRight;}
   
   int GetDepth() const {return fDepth;}
   const Point& GetPoint() const {return *fPoint;}
   
   const KDTreeNode& FindNodeContaining(const Point& point) const;
   const KDTreeNode& CheckParentForCloserNodes(const Point& point, const KDTreeNode& best) const;
   
   void OutputGraphViz(std::ostream& out) const;
   
private:
   unsigned int fDepth;
   Point* fPoint;
   KDTreeNode *fParent;
   KDTreeNode *fLeft;
   KDTreeNode *fRight;	
   
   const KDTreeNode* GetParent() const {return fParent;}
   const KDTreeNode* GetLeftChild() const {return fLeft;}
   const KDTreeNode* GetRightChild() const {return fRight;}
   
   bool CheckOtherSideofSplittingPlane(const Point& point, const double radius) const;
   const KDTreeNode& SearchChildren(const Point& point, const KDTreeNode& currentBest) const;
   bool IsCloserToPoint(const Point& point, const KDTreeNode& currentBest) const;
};

//______________________________________________________________________________
class KDTree {
   public:
      KDTree(std::vector<Point*>& pointList);
      KDTree(const KDTree& other);
      virtual ~KDTree();
      
      const Point& NearestNeighbour(const Point& point) const;
      void OutputGraphViz(std::ostream& out) const;
      
   private:
      KDTreeNode *fRoot;
      
      KDTreeNode* BuildNode(std::vector<Point*>& pointList, KDTreeNode* parent, int depth=0);
      
};

#endif
{'fraction_non_alphanumeric': 0.11928559724725545, 'fraction_numerical': 0.00032770768474520726, 'mean_word_length': 3.8406026962727995, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 13, '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': '3331521', 'n_tokens_mistral': 1927, 'n_tokens_neox': 1848, 'n_words': 521}