MCPcopy Create free account
hub / github.com/antlr/codebuff / whitespaceEditDistance

Method whitespaceEditDistance

src/org/antlr/codebuff/Dbg.java:194–200  ·  view source on GitHub ↗
(String s, String t)

Source from the content-addressed store, hash-verified

192 for our doc distance, I think it's ok to measure as same
193 */
194 public static int whitespaceEditDistance(String s, String t) {
195 int s_spaces = Tool.count(s, ' ');
196 int s_nls = Tool.count(s, '\n');
197 int t_spaces = Tool.count(t, ' ');
198 int t_nls = Tool.count(t, '\n');
199 return Math.abs(s_spaces - t_spaces) + Math.abs(s_nls - t_nls);
200 }
201
202 /** Compute a document difference metric 0-1.0 between two documents that
203 * are identical other than (likely) the whitespace and comments.

Callers 1

docDiffMethod · 0.95

Calls 1

countMethod · 0.95

Tested by

no test coverage detected