<commit_before>
//
// Copyright (C) 2015-2016 Yahoo! JAPAN Research
//
// This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License. 
// To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/4.0/.
//

#pragma once

#include	"NGT/defines.h"
#include	"NGT/Common.h"
#include	"NGT/ObjectSpace.h"
#include	<algorithm>

namespace NGT {
  class DVPTree;
  class Node {
  public:
    typedef unsigned int	NodeID;
    class ID {
    public:
      enum Type {
	Leaf		= 1,
	Internal	= 0
      };
    ID():id(0) {}
      ID &operator=(const ID &n) {
	id = n.id;
	return *this;
      }
      ID &operator=(int i) {
	setID(i);
	return *this;
      }
      bool operator==(ID &n) { return id == n.id; }
      bool operator<(ID &n) { return id < n.id; }
      Type getType() { return (Type)((0x80000000 & id) >> 31); }
      NodeID getID() { return 0x7fffffff & id; }
      NodeID get() { return id; }
      void setID(NodeID i) { id = (0x80000000 & id) | i; }
      void setType(Type t) { id = (t << 31) | getID(); }
      void setRaw(NodeID i) { id = i; }
      void setNull() { id = 0; }
      void serialize(ofstream &os) { NGT::Serializer::write(os, id); }
      void deserialize(ifstream &is) { NGT::Serializer::read(is, id); }
      void serializeAsText(ofstream &os) { NGT::Serializer::writeAsText(os, id);	}
      void deserializeAsText(ifstream &is) { NGT::Serializer::readAsText(is, id); }
    protected:
      NodeID id;
    };

    class Object {
    public:
      Object():object(0) {}
      bool operator<(const Object &o) const { return distance < o.distance; }
      static const double	Pivot = -1.0;
      ObjectID		id;
      PersistentObject	*object;
      Distance		distance;
      Distance		leafDistance;
      int		clusterID;
    };

    typedef vector<Object>	Objects;

    Node() {
      parent.setNull();
      id.setNull();
    }

    virtual ~Node() {}

    Node &operator=(const Node &n) {
      id = n.id;
      parent = n.parent;
      return *this;
    }

    void serialize(ofstream &os) {
      id.serialize(os);
      parent.serialize(os);<commit_msg>fixed const member<commit_after>
//
// Copyright (C) 2015-2016 Yahoo! JAPAN Research
//
// This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License. 
// To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/4.0/.
//

#pragma once

#include	"NGT/defines.h"
#include	"NGT/Common.h"
#include	"NGT/ObjectSpace.h"
#include	<algorithm>

namespace NGT {
  class DVPTree;
  class Node {
  public:
    typedef unsigned int	NodeID;
    class ID {
    public:
      enum Type {
	Leaf		= 1,
	Internal	= 0
      };
    ID():id(0) {}
      ID &operator=(const ID &n) {
	id = n.id;
	return *this;
      }
      ID &operator=(int i) {
	setID(i);
	return *this;
      }
      bool operator==(ID &n) { return id == n.id; }
      bool operator<(ID &n) { return id < n.id; }
      Type getType() { return (Type)((0x80000000 & id) >> 31); }
      NodeID getID() { return 0x7fffffff & id; }
      NodeID get() { return id; }
      void setID(NodeID i) { id = (0x80000000 & id) | i; }
      void setType(Type t) { id = (t << 31) | getID(); }
      void setRaw(NodeID i) { id = i; }
      void setNull() { id = 0; }
      void serialize(ofstream &os) { NGT::Serializer::write(os, id); }
      void deserialize(ifstream &is) { NGT::Serializer::read(is, id); }
      void serializeAsText(ofstream &os) { NGT::Serializer::writeAsText(os, id);	}
      void deserializeAsText(ifstream &is) { NGT::Serializer::readAsText(is, id); }
    protected:
      NodeID id;
    };

    class Object {
    public:
      Object():object(0) {}
      bool operator<(const Object &o) const { return distance < o.distance; }
      static constexpr double	Pivot = -1.0;
      ObjectID		id;
      PersistentObject	*object;
      Distance		distance;
      Distance		leafDistance;
      int		clusterID;
    };

    typedef vector<Object>	Objects;

    Node() {
      parent.setNull();
      id.setNull();
    }

    virtual ~Node() {}

    Node &operator=(const Node &n) {
      id = n.id;
      parent = n.parent;
      return *this;
    }

    void serialize(ofstream &os) {
      id.serialize(os);
      parent.serialize(os);
{'fraction_non_alphanumeric': 0.14414831981460025, 'fraction_numerical': 0.01993047508690614, 'mean_word_length': 2.4947368421052634, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 6, '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': '5658031', 'n_tokens_mistral': 1576, 'n_tokens_neox': 1498, 'n_words': 393}