File tree Expand file tree Collapse file tree
src/main/java/org/variantsync/vevos/simulation/variability/sequenceextraction Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -101,7 +101,19 @@ private static Set<LinkedList<SPLCommit>> retrieveSequencesForStart(final Map<SP
101101 // We continue to build sequences, going from parent to descendents, until the ends of all possible sequences have been reached
102102 boolean incomplete = true ;
103103 while (incomplete ) {
104+ // Why do we have to create a new HashSet every iteration?
105+ // (See comments https://github.com/VariantSync/VEVOS_Simulation/pull/13#discussion_r960891984)
106+ // It makes the code a lot simpler and runtime should not really be an issue here.
107+ // If we do not create a new set in each iteration, we have to create additional checks, because we can
108+ // only update the old sequence if there is only one child. If there is more than one child, we have to
109+ // first create copies of the sequence for each child and add these sequences to the set.
110+ // Finally, we could change the initial sequence in-place for the last child. However, because the children
111+ // are provided as a set, we either first have to convert the set to a list or array (which is the same as
112+ // creating a new set above), or we have to introduce additional counters and/or flags and checks.
113+ // It is not pretty. I was at least not able to think of something simpler, without introducing additional
114+ // cost elsewhere.
104115 Set <LinkedList <SPLCommit >> updatedSet = new HashSet <>();
116+
105117 // Set to false at the start of the iteration, it is set to true if at least one sequence has been extended
106118 incomplete = false ;
107119 // For all found sequences, check whether their last commit has more children that can be added to the sequence
You can’t perform that action at this time.
0 commit comments