43 #include <Bpp/Exceptions.h> 44 #include <Bpp/Text/TextTools.h> 57 id_(node.id_), name_(0),
60 distanceToFather_(0), nodeProperties_(), branchProperties_()
98 void Node::swap(
size_t branch1,
size_t branch2)
throw (IndexOutOfBoundsException)
100 if (branch1 > branch2)
102 size_t tmp = branch1;
106 Node* node1 = getSon(branch1);
107 Node* node2 = getSon(branch2);
110 addSon(branch1, node2);
111 addSon(branch2, node1);
116 vector<const Node *> neighbors;
118 for(
size_t i = 0; i <
sons_.size(); i++) neighbors.push_back(
sons_[i]);
124 vector<Node *> neighbors;
126 for(
size_t i = 0; i <
sons_.size(); i++) neighbors.push_back(
sons_[i]);
133 throw NullPointerException(
"Node::getSonPosition(). Empty node given as input.");
134 for(
size_t i = 0; i < sons_.size(); i++)
136 if(sons_[i] == son)
return i;
virtual bool hasName() const
Tell is this node has a name.
virtual Clonable * getBranchProperty(const std::string &name)
std::vector< Node * > sons_
virtual bool hasDistanceToFather() const
Tell is this node has a distance to the father.
virtual bool hasBootstrapValue() const
Node & operator=(const Node &node)
Assignation operator.
double * distanceToFather_
virtual bool hasFather() const
Tell if this node has a father node.
std::vector< const Node * > getNeighbors() const
std::map< std::string, Clonable * > nodeProperties_
std::map< std::string, Clonable * > branchProperties_
virtual size_t getSonPosition(const Node *son) const
Exception thrown when something is wrong with a particular node.
The phylogenetic node class.
virtual void swap(size_t branch1, size_t branch2)
General exception thrown if a property could not be found.
Node()
Build a new void Node object.
virtual bool hasBranchProperty(const std::string &name) const
virtual double getBootstrapValue() const