This repository was archived by the owner on Aug 5, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 5 files changed +4142
-4244
lines changed Expand file tree Collapse file tree 5 files changed +4142
-4244
lines changed Original file line number Diff line number Diff line change @@ -1446,9 +1446,9 @@ class DiffMatchPatch {
14461446 * Returns the best match index or -1.
14471447 */
14481448 int _match_bitap (String text, String pattern, int loc) {
1449- Expect . isTrue (Match_MaxBits == 0 || pattern.length <= Match_MaxBits ,
1450- 'Pattern too long for this application.' );
1451-
1449+ if (Match_MaxBits != 0 && pattern.length > Match_MaxBits ) {
1450+ throw new Exception ( 'Pattern too long for this application.' );
1451+ }
14521452 // Initialise the alphabet.
14531453 Map <String , int > s = _match_alphabet (pattern);
14541454
@@ -1967,7 +1967,7 @@ class DiffMatchPatch {
19671967 }
19681968 while (! bigpatch.diffs.isEmpty &&
19691969 patch.length1 < patch_size - Patch_Margin ) {
1970- int diff_type = bigpatch.diffs[0 ].operation;
1970+ Operation diff_type = bigpatch.diffs[0 ].operation;
19711971 String diff_text = bigpatch.diffs[0 ].text;
19721972 if (diff_type == Operation .insert) {
19731973 // Insertions are harmless.
Original file line number Diff line number Diff line change 1919library DiffMatchPatch;
2020
2121import 'dart:math' ;
22+ import 'dart:collection' ;
2223
2324part 'DMPClass.dart' ;
2425part 'DiffClass.dart' ;
Original file line number Diff line number Diff line change @@ -72,13 +72,13 @@ class Expect {
7272 static void mapEquals (Map expected, Map actual, String msg) {
7373 for (var k in actual.keys) {
7474 if (! expected.containsKey (k)) {
75- throw new Exception ('Expect.mapEquals(unexpected key <$key > found '
75+ throw new Exception ('Expect.mapEquals(unexpected key <$k > found '
7676 'expected: <$expected >, actual: <$actual > $msg ) fails' );
7777 }
7878 }
7979 for (var k in expected.keys) {
8080 if (! actual.containsKey (k)) {
81- throw new Exception ('Expect.mapEquals(key <$key > not found '
81+ throw new Exception ('Expect.mapEquals(key <$k > not found '
8282 'expected: <$expected >, actual: <$actual > $msg ) fails' );
8383 }
8484 Expect .equals (actual[k], expected[k], "$msg [Key: $k ]" );
Original file line number Diff line number Diff line change @@ -5,8 +5,10 @@ import '../DiffMatchPatch.dart';
55// dart2js --out=Speedtest.dart.js Speedtest.dart
66
77void launch (Event e) {
8- String text1 = document.query ('#text1' ).value;
9- String text2 = document.query ('#text2' ).value;
8+ HtmlElement input1 = document.getElementById ('text1' );
9+ HtmlElement input2 = document.getElementById ('text2' );
10+ String text1 = input1.text;
11+ String text2 = input2.text;
1012
1113 DiffMatchPatch dmp = new DiffMatchPatch ();
1214 dmp.Diff_Timeout = 0.0 ;
@@ -17,12 +19,11 @@ void launch(Event e) {
1719 DateTime date_end = new DateTime .now ();
1820
1921 var ds = dmp.diff_prettyHtml (d);
20- document.query ( '# outputdiv' ).setInnerHtml (
22+ document.getElementById ( ' outputdiv' ).setInnerHtml (
2123 '$ds <BR>Time: ${date_end .difference (date_start )} (h:mm:ss.mmm)' );
2224}
2325
2426void main () {
25- document.query ( '# launch' ).addEventListener ('click' , launch);
26- document.query ( '# outputdiv' ).setInnerHtml ('' );
27+ document.getElementById ( ' launch' ).addEventListener ('click' , launch);
28+ document.getElementById ( ' outputdiv' ).setInnerHtml ('' );
2729}
28-
You can’t perform that action at this time.
0 commit comments