Split PathHierarchy implementation into different files. #662
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Bug/issue #, if applicable:
Summary
This splits the PathHierarchy implementation into separate files for various responsibilities.
This was previously all in one file to keep as much as possible of its implementation file private. The current length (~1500 lines) is starting to approach the point where the file length makes the code unnecessarily hard to follow. I would have been fine as-is, but some new features and enhancements that I've been working, when added together, start to make this a 2500-3000 line file, which has a real impact on the readability of it.
Splitting this into smaller files meant exposing a little bit of the API, but I find that it still sufficiently encapsulated and that the code readability improvements of spitting into smaller files are worth it.
Ignoring the moved—but unchanged—code, these are the actual changes in this PR:
The access level of the top-level DisambiguationTree struct is changed from
fileprivate
tointernal
so that the other files can use it. It is also:DisambiguationContainer
to better reflect that its implementation may not always represent a tree.The read access level of the
children
property onPathHierarchy.Node
is changed fromfileprivate
tointernal
. The write access level remainsprivate(set)
.The
availableChildren
data forPathHierarchy.Error.unknownName
is changed from an array to a set. This makes it consistent withPathHierarchy.Error.notFound
and better reflect that the order doesn't matter because the values are sorted by near-miss proximity to the next path component in the authored link.Dependencies
None.
Testing
None. This isn't a user-facing change.
Checklist
Make sure you check off the following items. If they cannot be completed, provide a reason.
[ ] Added tests./bin/test
script and it succeeded[ ] Updated documentation if necessary