Skip to content

Commit

Permalink
Add comment that explains purpose of SquashedParts record
Browse files Browse the repository at this point in the history
  • Loading branch information
dnestoro committed Apr 12, 2024
1 parent d8b8cdd commit fe65af9
Showing 1 changed file with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,22 @@ public class CompressedGlobTrie {
public record GlobWithInfo(String pattern, String additionalContent) {
}

/*
* Data transfer object that points to the next matched child instance and its index in the
* pattern parts list
*/
private record MatchedNode(GlobTrieNode child, int lastMatchedChildIndex) {
}

/*
* In case we have a complex level like: .../bar*Test*set/... its representation in the trie
* will be: bar* -> Test* -> set; In order to find all the nodes (on the same level) we need to
* squash them and return the number of squashed parts. Example: foo/bar*Test*set/1.txt pattern
* will be transformed into the following list of parts: [foo, bar*, Test*, set, 1.txt] in the
* first phase of the algorithm. Based on this list we don't know where the level, which starts
* with bar*, ends. To figure that out, we call a helper function which returns bar*Test*set and
* the number 3 because it squashed "bar*", "Test*" and "set" into one part.
*/
private record SquashedParts(String squashedPart, int numberOfSquashedParts) {
}

Expand Down

0 comments on commit fe65af9

Please sign in to comment.