Skip to content

Commit 78975f8

Browse files
committed
docs: note that the diff parser does not require stacks
1 parent cd9e3ab commit 78975f8

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

src/main/java/org/variantsync/diffdetective/variation/diff/parse/VariationDiffParser.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,15 @@ public record DiffLine(DiffType diffType, String content) {
7979

8080

8181
/* State */
82+
/* Implementation note:
83+
* We use stacks to keep track of the path from the current node (the top element in the stack)
84+
* to the root (the bottom element in the stack) of the variation diff. This is not strictly
85+
* necessary because as soon as a node is pushed onto the stack, the corresponding edge is also
86+
* inserted. Hence, we could reconstruct the stack by traversing the current graph using
87+
* {@link DiffNode#getParent} and check for the root using {@link DiffNode#isRoot}.
88+
* However, for consistency with the papers that explain this algorithm and for ease of
89+
* implementation, we keep the stack based implementation.
90+
*/
8291

8392
/**
8493
* A stack containing the current path before the edit from the root of the currently parsed

0 commit comments

Comments
 (0)