File tree Expand file tree Collapse file tree
src/main/java/org/variantsync/diffdetective/variation Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -82,4 +82,26 @@ public static <T extends Label> String variationDiffUnparser(VariationDiff<T> di
8282 public static String variationDiffUnparser (VariationDiff <DiffLinesLabel > diff ) throws IOException {
8383 return variationDiffUnparser (diff , DiffLinesLabel ::withInvalidLineNumbers );
8484 }
85+
86+ public static String undiff (String text , Time time ) {
87+ StringBuilder result = new StringBuilder ();
88+ String [] textSplit = text .split ("\n " );
89+ if (Time .AFTER == time ) {
90+ for (String line : textSplit ) {
91+ if (line .charAt (0 ) != '-' ) {
92+ result .append (line .substring (1 ));
93+ result .append ("\n " );
94+ }
95+ }
96+ return result .substring (0 , result .length () - 1 );
97+ } else {
98+ for (String line : textSplit ) {
99+ if (line .charAt (0 ) != '+' ) {
100+ result .append (line .substring (1 ));
101+ result .append ("\n " );
102+ }
103+ }
104+ return result .substring (0 , result .length () - 1 );
105+ }
106+ }
85107}
You can’t perform that action at this time.
0 commit comments