/*
    Copyright (C) 2012 Bartosz Broda, Jacek Bochenek, Łukasz Biłeńkij, 
    Damian Jaworski, Wojciech Mazur, Dominik Piasecki, Maciej Piasecki, 
    Radosław Ramocki
    
    This program is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published by the Free
Software Foundation; either version 3 of the License, or (at your option)
any later version.

    This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. 

    See the LICENSE and COPYING files for more details.
*/

#ifndef NODE_H
#define NODE_H

#include <cstdlib>
#include <vector>

/**
  Class representing node of CLUTO tree
  */
class Node
{
public:
    Node(int id, size_t level, double similarity);

    int GetID() const;

    size_t GetLevel() const;

    size_t GetLevelsAhead() const;

    void SetLevelsAhead(size_t levels);

    double GetSimilarity() const;

    void AddChild(Node * child);

    Node * GetChild(size_t pos);

    size_t GetChildrenNo();

    bool HasChildren();

    void SetOffsets(size_t xoffset, size_t yoffset);

    size_t GetXOffset() const;

    size_t GetYOffset() const;

private:
    /**
      Id of current Node
      */
    int id;

    /**
      Level of current Node
      */
    size_t level;

    /**
      Number of maximum level in subtrees
      */
    size_t levelsAhead;

    /**
      Similarity of children of the node. In case of leaf -- equals 0
      */
    double similarity;

    /**
      Vector of children of this node
      */
    std::vector<Node *> children;

    /**
      Offset used in dendrogram drawing
      */
    size_t xoffset;

    /**
      Offset used in dendrogram drawing
      */
    size_t yoffset;

};

#endif // NODE_H
