Home | History | Annotate | Download | only in plaintext

Lines Matching refs:text1

133    * @param text1 Old string to be diffed.
137 public LinkedList<Diff> diff_main(String text1, String text2) {
138 return diff_main(text1, text2, true);
144 * @param text1 Old string to be diffed.
151 public LinkedList<Diff> diff_main(String text1, String text2,
154 if (text1 == null || text2 == null) {
160 if (text1.equals(text2)) {
162 diffs.add(new Diff(Operation.EQUAL, text1));
167 int commonlength = diff_commonPrefix(text1, text2);
168 String commonprefix = text1.substring(0, commonlength);
169 text1 = text1.substring(commonlength);
173 commonlength = diff_commonSuffix(text1, text2);
174 String commonsuffix = text1.substring(text1.length() - commonlength);
175 text1 = text1.substring(0, text1.length() - commonlength);
179 diffs = diff_compute(text1, text2, checklines);
197 * @param text1 Old string to be diffed.
204 protected LinkedList<Diff> diff_compute(String text1, String text2,
208 if (text1.length() == 0) {
216 diffs.add(new Diff(Operation.DELETE, text1));
220 String longtext = text1.length() > text2.length() ? text1 : text2;
221 String shorttext = text1.length() > text2.length() ? text2 : text1;
225 Operation op = (text1.length() > text2.length()) ?
235 String[] hm = diff_halfMatch(text1, text2);
254 if (checklines && (text1.length() < 100 || text2.length() < 100)) {
260 LinesToCharsResult b = diff_linesToChars(text1, text2);
261 text1 = b.chars1;
266 diffs = diff_map(text1, text2);
270 diffs.add(new Diff(Operation.DELETE, text1));
329 * @param text1 First string.
331 * @return An object containing the encoded text1, the encoded text2 and
335 protected LinesToCharsResult diff_linesToChars(String text1, String text2) {
345 String chars1 = diff_linesToCharsMunge(text1, lineArray, lineHash);
409 * @param text1 Old string to be diffed.
413 protected LinkedList<Diff> diff_map(String text1, String text2) {
416 int text1_length = text1.length();
458 && text1.charAt(x) == text2.charAt(y)) {
475 return diff_path1(v_map1, text1, text2);
479 LinkedList<Diff> a = diff_path1(v_map1, text1.substring(0, x),
481 a.addAll(diff_path2(v_map2, text1.substring(x), text2.substring(y)));
504 && text1.charAt(text1_length - x - 1)
522 = diff_path1(v_map1, text1.substring(0, text1_length - x),
524 a.addAll(diff_path2(v_map2, text1.substring(text1_length - x),
539 * @param text1 Old string fragment to be diffed.
544 String text1, String text2) {
546 int x = text1.length();
554 path.getFirst().text = text1.charAt(x) + path.getFirst().text;
557 text1.substring(x, x + 1)));
574 assert (text1.charAt(x) == text2.charAt(y))
577 path.getFirst().text = text1.charAt(x) + path.getFirst().text;
579 path.addFirst(new Diff(Operation.EQUAL, text1.substring(x, x + 1)));
592 * @param text1 Old string fragment to be diffed.
597 String text1, String text2) {
599 int x = text1.length();
607 path.getLast().text += text1.charAt(text1.length() - x - 1);
610 text1.substring(text1.length() - x - 1, text1.length() - x)));
627 assert (text1.charAt(text1.length() - x - 1)
631 path.getLast().text += text1.charAt(text1.length() - x - 1);
634 text1.substring(text1.length() - x - 1, text1.length() - x)));
663 * @param text1 First string.
667 public int diff_commonPrefix(String text1, String text2) {
669 int n = Math.min(text1.length(), text2.length());
671 if (text1.charAt(i) != text2.charAt(i)) {
681 * @param text1 First string.
685 public int diff_commonSuffix(String text1, String text2) {
687 int text1_length = text1.length();
691 if (text1.charAt(text1_length - i) != text2.charAt(text2_length - i)) {
702 * @param text1 First string.
704 * @return Five element String array, containing the prefix of text1, the
705 * suffix of text1, the prefix of text2, the suffix of text2 and the
708 protected String[] diff_halfMatch(String text1, String text2) {
709 String longtext = text1.length() > text2.length() ? text1 : text2;
710 String shorttext = text1.length() > text2.length() ? text2 : text1;
734 if (text1.length() > text2.length()) {
1254 * loc is a location in text1, compute and return the equivalent location in
1258 * @param loc Location within text1.
1391 * required to transform text1 into text2.
1429 * Given the original text1, and an encoded string which describes the
1430 * operations required to transform text1 into text2, compute the full diff.
1431 * @param text1 Source string for the diff.
1436 public LinkedList<Diff> diff_fromDelta(String text1, String delta)
1439 int pointer = 0; // Cursor in text1
1481 text = text1.substring(pointer, pointer += n);
1484 + ") larger than source text length (" + text1.length()
1499 if (pointer != text1.length()) {
1501 + ") smaller than source text length (" + text1.length() + ").");
1735 * Compute a list of patches to turn text1 into text2.
1737 * @param text1 Old text.
1741 public LinkedList<Patch> patch_make(String text1, String text2) {
1742 if (text1 == null || text2 == null) {
1746 LinkedList<Diff> diffs = diff_main(text1, text2, true);
1751 return patch_make(text1, diffs);
1756 * Compute a list of patches to turn text1 into text2.
1757 * text1 will be derived from the provided diffs.
1758 * @param diffs Array of diff tuples for text1 to text2.
1766 String text1 = diff_text1(diffs);
1767 return patch_make(text1, diffs);
1772 * Compute a list of patches to turn text1 into text2.
1773 * text2 is ignored, diffs are the delta between text1 and text2.
1774 * @param text1 Old text
1776 * @param diffs Array of diff tuples for text1 to text2.
1778 * @deprecated Prefer patch_make(String text1, LinkedList<Diff> diffs).
1780 public LinkedList<Patch> patch_make(String text1, String text2,
1782 return patch_make(text1, diffs);
1787 * Compute a list of patches to turn text1 into text2.
1788 * text2 is not provided, diffs are the delta between text1 and text2.
1789 * @param text1 Old text.
1790 * @param diffs Array of diff tuples for text1 to text2.
1793 public LinkedList<Patch> patch_make(String text1, LinkedList<Diff> diffs) {
1794 if (text1 == null || diffs == null) {
1803 int char_count1 = 0; // Number of characters into the text1 string.
1805 // Start with text1 (prepatch_text) and apply the diffs until we arrive at
1808 String prepatch_text = text1;
1809 String postpatch_text = text1;
1926 String text1 = diff_text1(aPatch.diffs);
1929 if (text1.length() > this.Match_MaxBits) {
1933 text1.substring(0, this.Match_MaxBits), expected_loc);
1936 text1.substring(text1.length() - this.Match_MaxBits),
1937 expected_loc + text1.length() - this.Match_MaxBits);
1944 start_loc = match_main(text, text1, expected_loc);
1958 Math.min(start_loc + text1.length(), text.length()));
1963 if (text1.equals(text2)) {
1966 + text.substring(start_loc + text1.length());
1970 LinkedList<Diff> diffs = diff_main(text1, text2, false);
1971 if (text1.length() > this.Match_MaxBits
1972 && diff_levenshtein(diffs) / (float) text1.length()