bpp-core
2.2.0
|
Simple implementation of TNode. More...
#include <Bpp/Graph/BasicTNode.h>
Public Member Functions | |
BasicTNode () | |
Simple constructor. More... | |
virtual | ~BasicTNode () |
Destructor. More... | |
BasicTNode (const BasicTNode &node) | |
Copy constructor. More... | |
BasicTNode & | operator= (const BasicTNode &node) |
Assignation operator. More... | |
BasicTNode * | clone () const |
Create a copy of this object and send a pointer to it. More... | |
const BasicTNode * | getNeighbor (int pos) const |
Get a neighbor of this node in const context. More... | |
BasicTNode * | getNeighbor (int pos) |
Get a neighbor of this node. More... | |
int | degree () const |
Get the degree i.e. the number of neighbors of this node. More... | |
const BasicTNode * | operator[] (int i) const |
Direct access to a neighbor in const context. More... | |
BasicTNode * | operator[] (int i) |
Direct access to a neighbor. More... | |
bool | hasFather () const |
Tell if the node has a father. More... | |
bool | hasFathers () const |
Tell if this node has one or more father nodes. More... | |
int | getNumberOfFathers () const |
Give the number of father nodes for this node. More... | |
const BasicTNode * | getFather (int pos) const |
Get a particular father in const environment. More... | |
BasicTNode * | getFather (int pos) |
Get a particular father. More... | |
const BasicTNode * | getFather () const |
Get the father in const environment. More... | |
BasicTNode * | getFather () |
Get the father. More... | |
virtual bool | isFather (const BasicTNode *node) const |
Tell if the node is a father of this node. More... | |
virtual void | addFather (BasicTNode *node) |
Add a father to this node. More... | |
virtual BasicTNode * | removeFather () |
Remove the father of this node. More... | |
bool | hasSons () const |
Tell if this node has one or more son nodes. More... | |
int | getNumberOfSons () const |
Give the number of son nodes for this node. More... | |
const BasicTNode * | getSon (int pos) const |
Get a particular son in const environment. More... | |
BasicTNode * | getSon (int pos) |
Get a particular son. More... | |
virtual bool | isSon (const BasicTNode *node) const |
Tell if a node is son of this node. More... | |
virtual void | addSon (BasicTNode *node) |
Add a son to this node. More... | |
virtual void | removeSon (BasicTNode *son) |
Remove a son of this node. More... | |
virtual BasicTNode * | removeSon (int pos) |
Remove a son of this node. More... | |
Private Attributes | |
std::vector< BasicTNode *> | sons_ |
BasicTNode * | father_ |
Simple implementation of TNode.
Contains only methods for node manipulation.
Definition at line 54 of file BasicTNode.h.
|
inline |
|
virtual |
Destructor.
When destroyed, the node remove himself as son of its father and as father of its sons.
Definition at line 48 of file BasicTNode.cpp.
BasicTNode::BasicTNode | ( | const BasicTNode & | node | ) |
Copy constructor.
Definition at line 57 of file BasicTNode.cpp.
|
virtual |
Add a father to this node.
Definition at line 136 of file BasicTNode.cpp.
References addSon(), father_, isFather(), and isSon().
Referenced by addSon().
|
virtual |
Add a son to this node.
Definition at line 181 of file BasicTNode.cpp.
References addFather(), isFather(), isSon(), and sons_.
Referenced by addFather().
|
inlinevirtual |
Create a copy of this object and send a pointer to it.
Implements bpp::TNode.
Definition at line 83 of file BasicTNode.h.
References BasicTNode().
|
inlinevirtual |
Get the degree i.e. the number of neighbors of this node.
Implements bpp::UNode.
Definition at line 92 of file BasicTNode.h.
|
virtual |
Get a particular father in const environment.
Implements bpp::TNode.
Definition at line 108 of file BasicTNode.cpp.
References getFather().
|
virtual |
Get a particular father.
Implements bpp::TNode.
Definition at line 115 of file BasicTNode.cpp.
References getFather().
|
virtual |
Get the father in const environment.
Implements bpp::TNode.
Definition at line 122 of file BasicTNode.cpp.
References father_.
Referenced by getFather().
|
virtual |
Get the father.
Implements bpp::TNode.
Definition at line 126 of file BasicTNode.cpp.
References father_.
|
virtual |
Get a neighbor of this node in const context.
pos | the position of the neighbor to get. |
Implements bpp::TNode.
Definition at line 70 of file BasicTNode.cpp.
|
virtual |
Get a neighbor of this node.
pos | the position of the neighbor to get. |
Implements bpp::TNode.
Definition at line 80 of file BasicTNode.cpp.
|
inlinevirtual |
Give the number of father nodes for this node.
Implements bpp::ONode.
Definition at line 104 of file BasicTNode.h.
References father_.
|
inlinevirtual |
Give the number of son nodes for this node.
Implements bpp::ONode.
Definition at line 131 of file BasicTNode.h.
References sons_.
|
virtual |
Get a particular son in const environment.
Implements bpp::TNode.
Definition at line 159 of file BasicTNode.cpp.
References sons_.
|
virtual |
Get a particular son.
Implements bpp::TNode.
Definition at line 166 of file BasicTNode.cpp.
References sons_.
|
inline |
|
inlinevirtual |
Tell if this node has one or more father nodes.
Implements bpp::ONode.
Definition at line 103 of file BasicTNode.h.
References father_.
Referenced by removeFather().
|
inlinevirtual |
Tell if this node has one or more son nodes.
Implements bpp::ONode.
Definition at line 130 of file BasicTNode.h.
References sons_.
|
virtual |
Tell if the node is a father of this node.
Definition at line 130 of file BasicTNode.cpp.
References father_.
Referenced by addFather(), and addSon().
|
virtual |
Tell if a node is son of this node.
Definition at line 173 of file BasicTNode.cpp.
References sons_.
Referenced by addFather(), and addSon().
BasicTNode & BasicTNode::operator= | ( | const BasicTNode & | node | ) |
|
virtual |
Direct access to a neighbor in const context.
No check is done, you have to ensure that you query an existing neighbor.
i | the position of the neighbor |
Implements bpp::TNode.
Definition at line 90 of file BasicTNode.cpp.
|
virtual |
Direct access to a neighbor.
No check is done, you have to ensure that you query an existing neighbor.
i | the position of the neighbor |
Implements bpp::TNode.
Definition at line 98 of file BasicTNode.cpp.
|
virtual |
Remove the father of this node.
Definition at line 147 of file BasicTNode.cpp.
References father_, hasFathers(), and removeSon().
Referenced by removeSon().
|
virtual |
Remove a son of this node.
Definition at line 190 of file BasicTNode.cpp.
References removeFather(), and sons_.
Referenced by removeFather().
|
virtual |
Remove a son of this node.
Definition at line 201 of file BasicTNode.cpp.
References sons_.
|
private |
Definition at line 57 of file BasicTNode.h.
Referenced by addFather(), degree(), getFather(), getNeighbor(), getNumberOfFathers(), hasFather(), hasFathers(), isFather(), operator=(), operator[](), and removeFather().
|
private |
Definition at line 56 of file BasicTNode.h.
Referenced by addSon(), degree(), getNeighbor(), getNumberOfSons(), getSon(), hasSons(), isSon(), operator=(), operator[](), and removeSon().