Skip to content

Commit 68d8131

Browse files
committed
refactor: rename the unparse methods
1 parent fbd6f3c commit 68d8131

3 files changed

Lines changed: 12 additions & 12 deletions

File tree

src/main/java/org/variantsync/diffdetective/experiments/thesis_es/UnparseAnalysis.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ public static String parseUnparseTree(String text, VariationDiffParseOptions opt
216216
String temp = "b";
217217
try {
218218
VariationTree<DiffLinesLabel> tree = VariationTree.fromText(text, VariationTreeSource.Unknown, option);
219-
temp = VariationUnparser.variationTreeUnparser(tree);
219+
temp = VariationUnparser.unparseTree(tree);
220220
} catch (Exception e) {
221221
e.printStackTrace();
222222
}
@@ -227,7 +227,7 @@ public static String parseUnparseDiff(String textDiff, VariationDiffParseOptions
227227
String temp = "b";
228228
try {
229229
VariationDiff<DiffLinesLabel> diff = VariationDiff.fromDiff(textDiff, option);
230-
temp = VariationUnparser.variationDiffUnparser(diff);
230+
temp = VariationUnparser.unparseDiff(diff);
231231
} catch (Exception e) {
232232
e.printStackTrace();
233233
}

src/main/java/org/variantsync/diffdetective/variation/VariationUnparser.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public class VariationUnparser {
2323
* @return the unparsed variation tree
2424
* @param <L> the type of labels of the tree
2525
*/
26-
public static <L extends Label> String variationTreeUnparser(VariationTree<L> tree, Function<List<String>, L> linesToLabel) {
26+
public static <L extends Label> String unparseTree(VariationTree<L> tree, Function<List<String>, L> linesToLabel) {
2727
if (!tree.root().getChildren().isEmpty()) {
2828
StringBuilder result = new StringBuilder();
2929
Stack<VariationTreeNode<L>> stack = new Stack<>();
@@ -57,8 +57,8 @@ public static <L extends Label> String variationTreeUnparser(VariationTree<L> tr
5757
* @param linesToLabel a function that converts lists of lines into labels
5858
* @return the unparsed variation tree
5959
*/
60-
public static String variationTreeUnparser(VariationTree<DiffLinesLabel> tree) {
61-
return variationTreeUnparser(tree, DiffLinesLabel::withInvalidLineNumbers);
60+
public static String unparseTree(VariationTree<DiffLinesLabel> tree) {
61+
return unparseTree(tree, DiffLinesLabel::withInvalidLineNumbers);
6262
}
6363

6464
/**
@@ -70,9 +70,9 @@ public static String variationTreeUnparser(VariationTree<DiffLinesLabel> tree) {
7070
* @param <L> the type of labels of the tree
7171
* @throws IOException
7272
*/
73-
public static <L extends Label> String variationDiffUnparser(VariationDiff<L> diff, Function<List<String>, L> linesToLabel) throws IOException {
74-
String tree1 = variationTreeUnparser(diff.project(Time.BEFORE), linesToLabel);
75-
String tree2 = variationTreeUnparser(diff.project(Time.AFTER), linesToLabel);
73+
public static <L extends Label> String unparseDiff(VariationDiff<L> diff, Function<List<String>, L> linesToLabel) throws IOException {
74+
String tree1 = unparseTree(diff.project(Time.BEFORE), linesToLabel);
75+
String tree2 = unparseTree(diff.project(Time.AFTER), linesToLabel);
7676
return JGitDiff.textDiff(tree1, tree2, SupportedAlgorithm.MYERS);
7777
}
7878

@@ -83,8 +83,8 @@ public static <L extends Label> String variationDiffUnparser(VariationDiff<L> di
8383
* @return the unparsed variation diff
8484
* @throws IOException
8585
*/
86-
public static String variationDiffUnparser(VariationDiff<DiffLinesLabel> diff) throws IOException {
87-
return variationDiffUnparser(diff, DiffLinesLabel::withInvalidLineNumbers);
86+
public static String unparseDiff(VariationDiff<DiffLinesLabel> diff) throws IOException {
87+
return unparseDiff(diff, DiffLinesLabel::withInvalidLineNumbers);
8888
}
8989

9090
/**

src/test/java/VariationUnparserTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,12 @@ public void testDiffUnparse(Path testCasePath, VariationDiffParseOptions parseOp
6060

6161
private static String parseUnparseTree(Path path, VariationDiffParseOptions option) throws IOException, DiffParseException {
6262
VariationTree<DiffLinesLabel> tree = VariationTree.fromFile(path, option);
63-
return VariationUnparser.variationTreeUnparser(tree);
63+
return VariationUnparser.unparseTree(tree);
6464
}
6565

6666
private static String parseUnparseDiff(Path path, VariationDiffParseOptions option) throws IOException, DiffParseException {
6767
VariationDiff<DiffLinesLabel> diff = VariationDiff.fromFile(path, option);
68-
return VariationUnparser.variationDiffUnparser(diff);
68+
return VariationUnparser.unparseDiff(diff);
6969
}
7070

7171
private static void assertEqualDiff(String expected, String actual) {

0 commit comments

Comments
 (0)