@@ -90,11 +90,25 @@ public class DiffNode<L extends Label> implements HasNodeType {
9090 public DiffNode (DiffType diffType , NodeType nodeType ,
9191 DiffLineNumber fromLines , DiffLineNumber toLines ,
9292 Node featureMapping , L label ) {
93+ this (diffType , fromLines , toLines , featureMapping , new VariationLabel <>(nodeType , label ));
94+ }
95+
96+ /**
97+ * Creates a DiffNode with the given parameters.
98+ * @param diffType The type of change made to this node.
99+ * @param fromLines The starting line number of the corresponding text.
100+ * @param toLines The ending line number of the corresponding text.
101+ * @param featureMapping The formula stored in this node. Should be null for artifact nodes.
102+ * @param label The label and type of this node.
103+ */
104+ public DiffNode (DiffType diffType ,
105+ DiffLineNumber fromLines , DiffLineNumber toLines ,
106+ Node featureMapping , VariationLabel <L > label ) {
93107 children [BEFORE .ordinal ()] = new ArrayList <>();
94108 children [AFTER .ordinal ()] = new ArrayList <>();
95109
96110 this .diffType = diffType ;
97- this .label = new VariationLabel <>( nodeType , label ) ;
111+ this .label = label ;
98112 this .from = fromLines ;
99113 this .to = toLines ;
100114 this .featureMapping = featureMapping ;
@@ -359,11 +373,10 @@ public DiffNode<L> split(Time time) {
359373 DiffType otherDiffType = DiffType .thatExistsOnlyAt (time );
360374 var other = new DiffNode <L >(
361375 otherDiffType ,
362- getNodeType (),
363376 getFromLine ().as (otherDiffType ),
364377 getToLine ().as (otherDiffType ),
365378 getFormula (),
366- Cast .unchecked (label .getInnerLabel (). clone ())
379+ Cast .unchecked (label .clone ())
367380 );
368381
369382 this .diffType = otherDiffType .inverse ();
@@ -810,11 +823,10 @@ public DiffNode<L> deepCopy(HashMap<DiffNode<L>, DiffNode<L>> oldToNew) {
810823 public DiffNode <L > shallowCopy () {
811824 return new DiffNode <L >(
812825 getDiffType (),
813- getNodeType (),
814826 getFromLine (),
815827 getToLine (),
816828 getFormula (),
817- Cast .unchecked (label .getInnerLabel (). clone ())
829+ Cast .unchecked (label .clone ())
818830 );
819831 }
820832
0 commit comments