50 father_->removeSon(
this);
52 for (
size_t i = 0 ; i < sons_.size() ; i++) {
53 sons_[i]->removeFather();
71 if (pos < 0 || pos > static_cast<int>(
sons_.size())) {
77 return sons_[
static_cast<size_t>(pos - 1)];
81 if (pos < 0 || pos > static_cast<int>(
sons_.size())) {
87 return sons_[
static_cast<size_t>(pos - 1)];
94 return sons_[
static_cast<size_t>(i)];
102 return sons_[
static_cast<size_t>(i)];
140 throw Exception(
"BasicTNode::addFather() This node already has a father.");
143 if (!node->
isSon(
this))
160 if (pos < 0 || pos > static_cast<int>(
sons_.size()) - 1) {
163 return sons_[
static_cast<size_t>(pos)];
167 if (pos < 0 || pos > static_cast<int>(
sons_.size()) - 1) {
170 return sons_[
static_cast<size_t>(pos)];
174 for (
size_t i = 0 ; i <
sons_.size() ; i++) {
175 if (
sons_[i] == node)
185 sons_.push_back(node);
193 for (
size_t i = 0 ; i <
sons_.size() ; i++) {
194 if (
sons_[i] == node) {
195 sons_.erase(
sons_.begin() +
static_cast<ptrdiff_t
>(i));
202 if (pos < 0 || pos > static_cast<int>(
sons_.size() - 1))
206 node->removeFather();
std::vector< BasicTNode *> sons_
virtual void addFather(BasicTNode *node)
Add a father to this node.
virtual void addSon(BasicTNode *node)
Add a son to this node.
This class allows to perform a correspondence analysis.
virtual bool isSon(const BasicTNode *node) const
Tell if a node is son of this node.
virtual BasicTNode * removeFather()
Remove the father of this node.
virtual bool isFather(const BasicTNode *node) const
Tell if the node is a father of this node.
const BasicTNode * getNeighbor(int pos) const
Get a neighbor of this node in const context.
Simple implementation of TNode.
BasicTNode & operator=(const BasicTNode &node)
Assignation operator.
BasicTNode()
Simple constructor.
The base class exception for NULL pointer error.
const BasicTNode * getSon(int pos) const
Get a particular son in const environment.
Index out of bounds exception class.
virtual void removeSon(BasicTNode *son)
Remove a son of this node.
const BasicTNode * getFather() const
Get the father in const environment.
const BasicTNode * operator[](int i) const
Direct access to a neighbor in const context.
bool hasFathers() const
Tell if this node has one or more father nodes.
virtual ~BasicTNode()
Destructor.