Examples of LinesToCharsResult


Examples of name.fraser.neil.plaintext.DiffMatchPatch.LinesToCharsResult

    // Convert lines down to characters.
    final ArrayList<String> tmpVector = new ArrayList<String>();
    tmpVector.add("");
    tmpVector.add("alpha\n");
    tmpVector.add("beta\n");
    assertLinesToCharsResultEquals("diff_linesToChars: Shared lines.", new LinesToCharsResult("\u0001\u0002\u0001", "\u0002\u0001\u0002", tmpVector), dmp.diff_linesToChars("alpha\nbeta\nalpha\n", "beta\nalpha\nbeta\n"));

    tmpVector.clear();
    tmpVector.add("");
    tmpVector.add("alpha\r\n");
    tmpVector.add("beta\r\n");
    tmpVector.add("\r\n");
    assertLinesToCharsResultEquals("diff_linesToChars: Empty string and blank lines.", new LinesToCharsResult("", "\u0001\u0002\u0003\u0003", tmpVector), dmp.diff_linesToChars("", "alpha\r\nbeta\r\n\r\n\r\n"));

    tmpVector.clear();
    tmpVector.add("");
    tmpVector.add("a");
    tmpVector.add("b");
    assertLinesToCharsResultEquals("diff_linesToChars: No linebreaks.", new LinesToCharsResult("\u0001", "\u0002", tmpVector), dmp.diff_linesToChars("a", "b"));

    // More than 256 to reveal any 8-bit limitations.
    final int n = 300;
    tmpVector.clear();
    final StringBuilder lineList = new StringBuilder();
    final StringBuilder charList = new StringBuilder();
    for (int x = 1; x < n + 1; x++) {
      tmpVector.add(x + "\n");
      lineList.append(x + "\n");
      charList.append(String.valueOf((char) x));
    }
    assertEquals(n, tmpVector.size());
    final String lines = lineList.toString();
    final String chars = charList.toString();
    assertEquals(n, chars.length());
    tmpVector.add(0, "");
    assertLinesToCharsResultEquals("diff_linesToChars: More than 256.", new LinesToCharsResult(chars, "", tmpVector), dmp.diff_linesToChars(lines, ""));
  }
View Full Code Here

Examples of name.fraser.neil.plaintext.diff_match_patch.LinesToCharsResult

    // Convert lines down to characters.
    ArrayList<String> tmpVector = new ArrayList<String>();
    tmpVector.add("");
    tmpVector.add("alpha\n");
    tmpVector.add("beta\n");
    assertLinesToCharsResultEquals("diff_linesToChars: Shared lines.", new LinesToCharsResult("\u0001\u0002\u0001", "\u0002\u0001\u0002", tmpVector), dmp.diff_linesToChars("alpha\nbeta\nalpha\n", "beta\nalpha\nbeta\n"));

    tmpVector.clear();
    tmpVector.add("");
    tmpVector.add("alpha\r\n");
    tmpVector.add("beta\r\n");
    tmpVector.add("\r\n");
    assertLinesToCharsResultEquals("diff_linesToChars: Empty string and blank lines.", new LinesToCharsResult("", "\u0001\u0002\u0003\u0003", tmpVector), dmp.diff_linesToChars("", "alpha\r\nbeta\r\n\r\n\r\n"));

    tmpVector.clear();
    tmpVector.add("");
    tmpVector.add("a");
    tmpVector.add("b");
    assertLinesToCharsResultEquals("diff_linesToChars: No linebreaks.", new LinesToCharsResult("\u0001", "\u0002", tmpVector), dmp.diff_linesToChars("a", "b"));

    // More than 256 to reveal any 8-bit limitations.
    int n = 300;
    tmpVector.clear();
    StringBuilder lineList = new StringBuilder();
    StringBuilder charList = new StringBuilder();
    for (int x = 1; x < n + 1; x++) {
      tmpVector.add(x + "\n");
      lineList.append(x + "\n");
      charList.append(String.valueOf((char) x));
    }
    assertEquals(n, tmpVector.size());
    String lines = lineList.toString();
    String chars = charList.toString();
    assertEquals(n, chars.length());
    tmpVector.add(0, "");
    assertLinesToCharsResultEquals("diff_linesToChars: More than 256.", new LinesToCharsResult(chars, "", tmpVector), dmp.diff_linesToChars(lines, ""));
  }
View Full Code Here

Examples of org.locationtech.geogig.api.plumbing.diff.DiffMatchPatch.LinesToCharsResult

        // yield wrong results for geometries over that limit.
        // This is a temporary hack, until a better solution is developed.

        oldText = geomToStringOfCoordinates(oldGeom);
        newText = geomToStringOfCoordinates(newGeom);
        LinesToCharsResult chars = coordsToChars(oldText, newText);
        diffs = diffMatchPatch.diff_main(chars.chars1, chars.chars2);
        charsToCoords(diffs, chars.lineArray);

        processDiffs(diffs);
View Full Code Here

Examples of org.locationtech.geogig.api.plumbing.diff.DiffMatchPatch.LinesToCharsResult

        Map<String, Integer> lineHash = new HashMap<String, Integer>();
        lineArray.add("");

        String chars1 = splitAndHash(text1, lineArray, lineHash, ' ');
        String chars2 = splitAndHash(text2, lineArray, lineHash, ' ');
        return new LinesToCharsResult(chars1, chars2, lineArray);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.