Skip to content

Commit a3511e1

Browse files
committed
make ViewSource applicable to trees as well
1 parent c325359 commit a3511e1

File tree

2 files changed

+8
-10
lines changed

2 files changed

+8
-10
lines changed

src/main/java/org/variantsync/diffdetective/variation/diff/view/DiffView.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ private static <L extends Label> VariationDiff<DiffLinesLabel> naive(final Varia
8585
Logger.error("Could not parse diff obtained with query {} at {}", d.getSource(), rho);
8686
throw e;
8787
}
88-
view.setSource(new ViewSource<>(d, rho, "naive"));
88+
view.setSource(new ViewSource(d, rho, "naive"));
8989

9090
return view;
9191
}
@@ -161,7 +161,7 @@ public static <L extends Label> VariationDiff<L> badgood(final VariationDiff<L>
161161

162162
// unify
163163
final VariationDiff<L> goodDiff = badDiff.toGood();
164-
goodDiff.setSource(new ViewSource<>(d, rho, "badgood"));
164+
goodDiff.setSource(new ViewSource(d, rho, "badgood"));
165165
goodDiff.assertConsistency();
166166
return goodDiff;
167167
}
@@ -270,7 +270,7 @@ record Edge<L extends Label>(DiffNode<L> childCopy, DiffNode<L> parentInD, Time
270270

271271
// Step 4: Build return value
272272
Assert.assertNotNull(rootCopy[0]);
273-
return new VariationDiff<>(rootCopy[0], new ViewSource<>(d, rho, "optimized"));
273+
return new VariationDiff<>(rootCopy[0], new ViewSource(d, rho, "optimized"));
274274
}
275275

276276
/**

src/main/java/org/variantsync/diffdetective/variation/diff/view/ViewSource.java

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,25 +3,23 @@
33
import java.util.List;
44

55
import org.variantsync.diffdetective.util.Source;
6-
import org.variantsync.diffdetective.variation.Label;
7-
import org.variantsync.diffdetective.variation.diff.VariationDiff;
86
import org.variantsync.diffdetective.variation.tree.view.relevance.Relevance;
97

108
/**
11-
* A {@link Source} that remembers that a variation diff represents a view on another variation
12-
* diff.
13-
* @param diff The original variation diff on which the variation diff with this source is a view on.
9+
* A {@link Source} that remembers that a variation tree or diff represents a view on another variation
10+
* tree or diff.
11+
* @param target The original variation tree/diff on which the view was created.
1412
* @param relevance The relevance predicate that was used to create the view.
1513
*/
16-
public record ViewSource<L extends Label>(VariationDiff<L> diff, Relevance relevance, String method) implements Source {
14+
public record ViewSource(Source target, Relevance relevance, String method) implements Source {
1715
@Override
1816
public String getSourceExplanation() {
1917
return "view";
2018
}
2119

2220
@Override
2321
public List<Source> getSources() {
24-
return List.of(diff);
22+
return List.of(target);
2523
}
2624

2725
@Override

0 commit comments

Comments
 (0)