-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathVariationDiffAdapter.java
More file actions
33 lines (28 loc) · 1.2 KB
/
VariationDiffAdapter.java
File metadata and controls
33 lines (28 loc) · 1.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
package org.variantsync.diffdetective.gumtree;
import org.variantsync.diffdetective.variation.Label;
import org.variantsync.diffdetective.variation.diff.DiffNode;
import org.variantsync.diffdetective.variation.diff.Projection;
import org.variantsync.diffdetective.variation.diff.Time;
import org.variantsync.diffdetective.variation.tree.VariationNode;
import org.variantsync.functjonal.Cast;
/**
* Adapter for running Gumtree's matching algorithms on the projections of variation diffs.
*
* This class is almost identical to {@link VariationTreeAdapter} except that it provides type safe
* access to the projected {@link DiffNode}.
*/
public class VariationDiffAdapter<L extends Label> extends VariationTreeAdapter<L> {
public VariationDiffAdapter(DiffNode<L> node, Time time) {
super(node.projection(time));
}
public VariationDiffAdapter(Projection<L> node) {
super(node);
}
@Override
protected VariationTreeAdapter<L> newInstance(VariationNode<?, L> node) {
return new VariationDiffAdapter<>(Cast.unchecked(node));
}
public DiffNode<L> getDiffNode() {
return Cast.<VariationNode<?, L>, Projection<L>>unchecked(getVariationNode()).getBackingNode();
}
}