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

Written some non-update API calls and "add" based update API calls #37

Merged
merged 16 commits into from
Jun 14, 2024

Conversation

ujjwal-shekhar
Copy link
Contributor

@ujjwal-shekhar ujjwal-shekhar commented Jun 14, 2024

Tasks Finished

  • Make a packed Tree_pointers class (involved a lot of issues with trying to make an array of bitfields that does not remain packed, had to manually create 14 members and define their public getters and setters).
  • Add Tree_pos get_last_child(const Tree_pos& parent_index)
  • Add Tree_pos get_first_child(const Tree_pos& parent_index)
  • Add bool is_last_child(const Tree_pos& self_index)
  • Add bool is_first_child(const Tree_pos& self_index)
  • Add Tree_pos get_sibling_next(const Tree_pos& sibling_id)
  • Add Tree_pos get_sibling_prev(const Tree_pos& sibling_id)
  • MAJOR: Add Tree_pos append_sibling(const Tree_pos& sibling_id, const X& data)
  • MAJOR: Add Tree_pos add_child(const Tree_pos& parent_index, const X& data)
  • MAJOR: Added a helper function Tree_pos _break_chunk_from(const Tree_pos abs_id) that is able to break a chunk into the least number of siblings
  • Added doxygen comments to make it easier for future contributors to work with.

Current TODOS

  • Add a fake chunk at the beginning to make INVALID = 0 for every member of the Tree_pointers class.
  • Add asserts and error checking for each function.
  • Verify if the current implementation of all the API calls is handling every possible case.
  • Look at possible refactoring for bitshifts and bitmasks (might improve readability).
  • Write pathological tests, and debug | HIGHEST PRIORITY

Upcoming TODOS (in order of planned completion)

  • Add postorder, preorder and sibling iterators.
  • Finish get_tree_width()
  • Add delete_leaf()
  • Add delete_subtree()
  • Add insert_next_sibling()
  • Write pathological tests for everything up until here.
  • Start benchmarking

Summary by CodeRabbit

  • New Features

    • Introduced a data structure for tree pointers, enhancing tree management capabilities.
    • Added new classes and methods for efficient tree node manipulation, parent-child relationships, and data storage.
  • Improvements

    • Updated tree management to include both long and short delta pointers for more flexible data handling.
    • Enhanced tree pointer structure storage efficiency with packed and aligned classes.

- Minor changes to the tree class.
- Currently debugging the `add_child()` brute method.
- Major target currently, is to fix the update to the bookkeeping.
- To add, private `_add_child_brute()` and `_add_child_hashmap()` calls. Which will be called by the public `add_child()`.
- To add, random tree generator to test flp.
- The invalidity of a tree_pointer is now reduced to checking if the parent is MAX_VALUE. Reason: The last guy can never be a parent.
- Stub implementations added for now, need to add tests and complete the implementation.

## Todos for now:
-[] Complete all query based API (other than `get_tree_width`).
-[] Complete `add_child` and `append_sibling`.
-[] Add pathological tests.
- `get_first_child`
- `get_last_child`
- `is_first_child`
- `is_last_child`

> These methods still need to be tested, can't be done until `add_child()` is ready.
…ve to iterate over every child chunk and change it's parent pointer when shifting chunks.
- _break_chunk_from
- _insert_chunk_after
- _fits_in_short_del

Refactored a few things and fixed minor bugs.

Will refactor, change a few constants and improve the comments, code quality before proceeding with testing/debugging.
Copy link
Contributor

coderabbitai bot commented Jun 14, 2024

Walkthrough

The recent changes across multiple files introduce new classes and data structures for better handling of tree pointers and node relationships. Additionally, a class with specific public and private member functions is added to enhance encapsulation and functionality. This results in optimized storage and manipulation of tree nodes and related operations.

Changes

Files Change Summary
hhds/testing.cpp Introduced MyClass with private and public member functions, enhancing class encapsulation and functionality.
hhds/tree.cpp, tree.hpp Added Tree_pointers and updated tree manipulation functions, constants and classes for efficient tree storage.

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant MyClass
    Client->>MyClass: callPrivateFunction()
    MyClass->>MyClass: privateFunction()
    MyClass->>MyClass: publicFunction()
    MyClass-->>Client: Return Response
Loading

Poem

In files of bytes, a story’s grown,
With nodes and trees to call our own.
Pointers smart and classes new,
Efficient paths our code pursues.
A bunny hops with joy and might,
In data’s realm, it takes its flight. 😊


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 9b46a68 and a1ea410.

Files selected for processing (3)
  • hhds/testing.cpp (1 hunks)
  • hhds/tree.cpp (1 hunks)
  • hhds/tree.hpp (1 hunks)
Additional comments not posted (5)
hhds/testing.cpp (4)

5-9: The encapsulation and internal function calling are implemented correctly.


11-13: Simple and clear implementation of the public function.


15-17: Good use of public interface to access private functionality.


21-25: Main function correctly demonstrates the use of class methods.

hhds/tree.cpp (1)

109-116: Proper use of main function to test the size of the Tree_pointers struct.

hhds/tree.cpp Show resolved Hide resolved
hhds/tree.hpp Show resolved Hide resolved
hhds/tree.hpp Show resolved Hide resolved
@renau renau merged commit 038e2ad into masc-ucsc:main Jun 14, 2024
1 check passed
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