Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New data structures for nodes #21

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

New data structures for nodes #21

wants to merge 2 commits into from

Conversation

trongnhanuit
Copy link
Member

Implement new data structures (and their functions) of phylogenetic nodes

Copy link
Collaborator

@cbielow cbielow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a few comments to enforce invariants and make it harder to

  1. use the new class wrong
  2. expose the relevant members, but hide others which the user should not concern himself
  3. avoid use of magic indices -- always give stuff a proper name

tree/node.h Outdated Show resolved Hide resolved
tree/node.h Outdated Show resolved Hide resolved
tree/node.h Outdated Show resolved Hide resolved
tree/node.h Outdated Show resolved Hide resolved
tree/node.h Outdated Show resolved Hide resolved
tree/node.cpp Outdated Show resolved Hide resolved
tree/node.cpp Outdated Show resolved Hide resolved
tree/node.cpp Outdated Show resolved Hide resolved
tree/node.h Outdated Show resolved Hide resolved
tree/node.h Outdated Show resolved Hide resolved
Copy link
Collaborator

@cbielow cbielow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

almost there :)

tree/node.cpp Outdated Show resolved Hide resolved
tree/node.cpp Outdated Show resolved Hide resolved
tree/node.cpp Outdated Show resolved Hide resolved
tree/node.cpp Outdated Show resolved Hide resolved
tree/node.cpp Outdated Show resolved Hide resolved
tree/node.cpp Outdated Show resolved Hide resolved
tree/node.cpp Outdated Show resolved Hide resolved
tree/node.h Outdated Show resolved Hide resolved
tree/node.h Outdated Show resolved Hide resolved
tree/node.cpp Outdated
Comment on lines 141 to 145
void PhyloNode::addLessInfoSeqs(std::string&& seq_name)
{
ASSERT(!is_internal_);
data_.leaf.less_info_seqs_.push_back(std::move(seq_name));
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is a bit of a duplicated interface now.
I could also write node.getLessInfoSeqs().push_back(std::move(seq_name))
Usually its bad design to allow that. Maybe keep this function and make the other const as suggested above.
The user cannot remove elements once they are inserted. That is fine, right?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah. I prefer setting getLessInfoSeqs() as const and having addLessInfoSeqs() for users to update it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants