Code view:

A painting is a person's account of this edit as text, recorded independently of the node mapping - a rendering often has several equally defensible answers where the mapping has one. Deletions and insertions carry no position on the opposite side in a painting, so that panel draws no caret for them.

Before

…lines 1–52 unchanged (52 lines)
53
54 if( txt == null || txt.length() == 0 ) {
55 return "1111111111";
56 }
57
58 // 1. Convert to lowercase
59 txt = txt.toLowerCase();
60
61 // 2. Remove anything not A-Z
62 txt = txt.replaceAll("[^a-z]", "");
63
64 // 2.5. Remove final e
65 txt = txt.replaceAll("e$", ""); // 2.0 only
…lines 66–184 unchanged (119 lines)

After

…lines 1–52 unchanged (52 lines)
53
54 if( txt == null || txt.length() == 0 ) {
55 return "1111111111";
56 }
57
58 // 1. Convert to lowercase
59 txt = txt.toLowerCase(java.util.Locale.ENGLISH);
60
61 // 2. Remove anything not A-Z
62 txt = txt.replaceAll("[^a-z]", "");
63
64 // 2.5. Remove final e
65 txt = txt.replaceAll("e$", ""); // 2.0 only
…lines 66–184 unchanged (119 lines)

Before

program
block_comment "/*\n * Licensed to the Apache Software Foundation (ASF) under"...
package_declaration
package "package"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "apache"
. "."
identifier "commons"
. "."
identifier "codec"
. "."
identifier "language"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "apache"
. "."
identifier "commons"
. "."
identifier "codec"
. "."
identifier "EncoderException"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "apache"
. "."
identifier "commons"
. "."
identifier "codec"
. "."
identifier "StringEncoder"
; ";"
block_comment "/**\n * Encodes a string into a caverphone value. \n *\n * This"...
class_declaration
modifiers
public "public"
class "class"
identifier "Caverphone"
super_interfaces
implements "implements"
type_list
type_identifier "StringEncoder"
class_body
{ "{"
block_comment "/**\n * Creates an instance of the Caverphone encoder\n "...
constructor_declaration
modifiers
public "public"
identifier "Caverphone"
formal_parameters
( "("
) ")"
constructor_body
{ "{"
explicit_constructor_invocation
super "super"
argument_list
( "("
) ")"
; ";"
} "}"
block_comment "/**\n * Find the caverphone value of a String. \n *\n "...
method_declaration
modifiers
public "public"
type_identifier "String"
identifier "caverphone"
formal_parameters
( "("
formal_parameter
type_identifier "String"
identifier "txt"
) ")"
block
{ "{"
line_comment "// NOTE: Version 1.0 of Caverphone is easily derivable from "...
line_comment "// by commenting out the 2.0 lines and adding in the 1.0 lin"...
if_statement (+31 nodes collapsed)
line_comment "// 1. Convert to lowercase"
expression_statement
assignment_expression
identifier "txt"
= "="
method_invocation
identifier "txt"
. "."
identifier "toLowerCase"
argument_list
( "("
) ")"
; ";"
line_comment "// 2. Remove anything not A-Z"
expression_statement
assignment_expression
identifier "txt"
= "="
method_invocation
identifier "txt"
. "."
identifier "replaceAll"
argument_list
( "("
string_literal
" "\""
string_fragment "[^a-z]"
" "\""
, ","
string_literal
" "\""
" "\""
) ")"
; ";"
line_comment "// 2.5. Remove final e"
expression_statement
assignment_expression
identifier "txt"
= "="
method_invocation
identifier "txt"
. "."
identifier "replaceAll"
argument_list
( "("
string_literal
" "\""
string_fragment "e$"
" "\""
, ","
string_literal
" "\""
" "\""
) ")"
; ";"
line_comment "// 2.0 only"
line_comment "// 3. Handle various start options"
expression_statement (+21 nodes collapsed)
expression_statement (+21 nodes collapsed)
expression_statement (+21 nodes collapsed)
expression_statement (+21 nodes collapsed)
line_comment "// 2.0 only"
expression_statement (+21 nodes collapsed)
line_comment "// 2.0 only - note the spec says ^enough here again, c+p err"...
expression_statement (+21 nodes collapsed)
expression_statement (+21 nodes collapsed)
line_comment "// 4. Handle replacements"
expression_statement (+21 nodes collapsed)
expression_statement (+21 nodes collapsed)
expression_statement (+21 nodes collapsed)
expression_statement (+21 nodes collapsed)
expression_statement (+21 nodes collapsed)
expression_statement (+21 nodes collapsed)
expression_statement (+21 nodes collapsed)
expression_statement (+21 nodes collapsed)
expression_statement (+21 nodes collapsed)
expression_statement (+21 nodes collapsed)
expression_statement (+21 nodes collapsed)
expression_statement (+21 nodes collapsed)
expression_statement (+21 nodes collapsed)
expression_statement (+21 nodes collapsed)
expression_statement (+21 nodes collapsed)
expression_statement (+21 nodes collapsed)
expression_statement (+21 nodes collapsed)
expression_statement (+21 nodes collapsed)
expression_statement (+21 nodes collapsed)
expression_statement (+21 nodes collapsed)
line_comment "// 2.0 only"
expression_statement (+21 nodes collapsed)
line_comment "// 2.0 only"
expression_statement (+21 nodes collapsed)
line_comment "// 2.0 only"
expression_statement (+21 nodes collapsed)
line_comment "// 2.0 only"
expression_statement (+21 nodes collapsed)
expression_statement (+21 nodes collapsed)
expression_statement (+21 nodes collapsed)
expression_statement (+21 nodes collapsed)
expression_statement (+21 nodes collapsed)
expression_statement (+21 nodes collapsed)
expression_statement (+21 nodes collapsed)
expression_statement (+21 nodes collapsed)
expression_statement (+21 nodes collapsed)
expression_statement (+21 nodes collapsed)
expression_statement (+21 nodes collapsed)
line_comment "//txt = txt.replaceAll(\"wy\", \"Wy\"); // 1.0 only"
expression_statement (+21 nodes collapsed)
expression_statement (+21 nodes collapsed)
line_comment "// 2.0 only"
line_comment "//txt = txt.replaceAll(\"why\", \"Why\"); // 1.0 only"
expression_statement (+21 nodes collapsed)
expression_statement (+21 nodes collapsed)
expression_statement (+21 nodes collapsed)
expression_statement (+21 nodes collapsed)
expression_statement (+21 nodes collapsed)
line_comment "// 2.0 only"
line_comment "//txt = txt.replaceAll(\"ry\", \"Ry\"); // 1.0 only"
expression_statement (+21 nodes collapsed)
expression_statement (+21 nodes collapsed)
expression_statement (+21 nodes collapsed)
line_comment "// 2.0 only"
line_comment "//txt = txt.replaceAll(\"ly\", \"Ly\"); // 1.0 only"
expression_statement (+21 nodes collapsed)
line_comment "//txt = txt.replaceAll(\"j\", \"y\"); // 1.0 only"
line_comment "//txt = txt.replaceAll(\"y3\", \"Y3\"); // 1.0 only"
line_comment "//txt = txt.replaceAll(\"y\", \"2\"); // 1.0 only"
line_comment "// 5. Handle removals"
expression_statement
assignment_expression
identifier "txt"
= "="
method_invocation
identifier "txt"
. "."
identifier "replaceAll"
argument_list
( "("
string_literal
" "\""
string_fragment "2"
" "\""
, ","
string_literal
" "\""
" "\""
) ")"
; ";"
expression_statement (+21 nodes collapsed)
line_comment "// 2.0 only"
expression_statement
assignment_expression
identifier "txt"
= "="
method_invocation
identifier "txt"
. "."
identifier "replaceAll"
argument_list
( "("
string_literal
" "\""
string_fragment "3"
" "\""
, ","
string_literal
" "\""
" "\""
) ")"
; ";"
line_comment "// 6. put ten 1s on the end"
expression_statement
assignment_expression
identifier "txt"
= "="
binary_expression
binary_expression
identifier "txt"
+ "+"
string_literal
" "\""
string_fragment "111111"
" "\""
+ "+"
string_literal
" "\""
string_fragment "1111"
" "\""
; ";"
line_comment "// 1.0 only has 6 1s"
line_comment "// 7. take the first six characters as the code"
return_statement
return "return"
method_invocation
identifier "txt"
. "."
identifier "substring"
argument_list
( "("
decimal_integer_literal "0"
, ","
decimal_integer_literal "10"
) ")"
; ";"
line_comment "// 1.0 truncates to 6"
} "}"
block_comment "/**\n * Encodes an Object using the caverphone algorithm."...
method_declaration (+66 nodes collapsed)
block_comment "/**\n * Encodes a String using the Caverphone algorithm. "...
method_declaration (+23 nodes collapsed)
block_comment "/**\n * Tests if the caverphones of two strings are ident"...
method_declaration (+39 nodes collapsed)
} "}"

After

program
block_comment "/*\n * Licensed to the Apache Software Foundation (ASF) under"...
package_declaration
package "package"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "apache"
. "."
identifier "commons"
. "."
identifier "codec"
. "."
identifier "language"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "apache"
. "."
identifier "commons"
. "."
identifier "codec"
. "."
identifier "EncoderException"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "apache"
. "."
identifier "commons"
. "."
identifier "codec"
. "."
identifier "StringEncoder"
; ";"
block_comment "/**\n * Encodes a string into a caverphone value. \n *\n * This"...
class_declaration
modifiers
public "public"
class "class"
identifier "Caverphone"
super_interfaces
implements "implements"
type_list
type_identifier "StringEncoder"
class_body
{ "{"
block_comment "/**\n * Creates an instance of the Caverphone encoder\n "...
constructor_declaration
modifiers
public "public"
identifier "Caverphone"
formal_parameters
( "("
) ")"
constructor_body
{ "{"
explicit_constructor_invocation
super "super"
argument_list
( "("
) ")"
; ";"
} "}"
block_comment "/**\n * Find the caverphone value of a String. \n *\n "...
method_declaration
modifiers
public "public"
type_identifier "String"
identifier "caverphone"
formal_parameters
( "("
formal_parameter
type_identifier "String"
identifier "txt"
) ")"
block
{ "{"
line_comment "// NOTE: Version 1.0 of Caverphone is easily derivable from "...
line_comment "// by commenting out the 2.0 lines and adding in the 1.0 lin"...
if_statement (+31 nodes collapsed)
line_comment "// 1. Convert to lowercase"
expression_statement
assignment_expression
identifier "txt"
= "="
method_invocation
identifier "txt"
. "."
identifier "toLowerCase"
argument_list
( "("
field_access
field_access
field_access
identifier "java"
. "."
identifier "util"
. "."
identifier "Locale"
. "."
identifier "ENGLISH"
) ")"
; ";"
line_comment "// 2. Remove anything not A-Z"
expression_statement
assignment_expression
identifier "txt"
= "="
method_invocation
identifier "txt"
. "."
identifier "replaceAll"
argument_list
( "("
string_literal
" "\""
string_fragment "[^a-z]"
" "\""
, ","
string_literal
" "\""
" "\""
) ")"
; ";"
line_comment "// 2.5. Remove final e"
expression_statement
assignment_expression
identifier "txt"
= "="
method_invocation
identifier "txt"
. "."
identifier "replaceAll"
argument_list
( "("
string_literal
" "\""
string_fragment "e$"
" "\""
, ","
string_literal
" "\""
" "\""
) ")"
; ";"
line_comment "// 2.0 only"
line_comment "// 3. Handle various start options"
expression_statement (+21 nodes collapsed)
expression_statement (+21 nodes collapsed)
expression_statement (+21 nodes collapsed)
expression_statement (+21 nodes collapsed)
line_comment "// 2.0 only"
expression_statement (+21 nodes collapsed)
line_comment "// 2.0 only - note the spec says ^enough here again, c+p err"...
expression_statement (+21 nodes collapsed)
expression_statement (+21 nodes collapsed)
line_comment "// 4. Handle replacements"
expression_statement (+21 nodes collapsed)
expression_statement (+21 nodes collapsed)
expression_statement (+21 nodes collapsed)
expression_statement (+21 nodes collapsed)
expression_statement (+21 nodes collapsed)
expression_statement (+21 nodes collapsed)
expression_statement (+21 nodes collapsed)
expression_statement (+21 nodes collapsed)
expression_statement (+21 nodes collapsed)
expression_statement (+21 nodes collapsed)
expression_statement (+21 nodes collapsed)
expression_statement (+21 nodes collapsed)
expression_statement (+21 nodes collapsed)
expression_statement (+21 nodes collapsed)
expression_statement (+21 nodes collapsed)
expression_statement (+21 nodes collapsed)
expression_statement (+21 nodes collapsed)
expression_statement (+21 nodes collapsed)
expression_statement (+21 nodes collapsed)
expression_statement (+21 nodes collapsed)
line_comment "// 2.0 only"
expression_statement (+21 nodes collapsed)
line_comment "// 2.0 only"
expression_statement (+21 nodes collapsed)
line_comment "// 2.0 only"
expression_statement (+21 nodes collapsed)
line_comment "// 2.0 only"
expression_statement (+21 nodes collapsed)
expression_statement (+21 nodes collapsed)
expression_statement (+21 nodes collapsed)
expression_statement (+21 nodes collapsed)
expression_statement (+21 nodes collapsed)
expression_statement (+21 nodes collapsed)
expression_statement (+21 nodes collapsed)
expression_statement (+21 nodes collapsed)
expression_statement (+21 nodes collapsed)
expression_statement (+21 nodes collapsed)
expression_statement (+21 nodes collapsed)
line_comment "//txt = txt.replaceAll(\"wy\", \"Wy\"); // 1.0 only"
expression_statement (+21 nodes collapsed)
expression_statement (+21 nodes collapsed)
line_comment "// 2.0 only"
line_comment "//txt = txt.replaceAll(\"why\", \"Why\"); // 1.0 only"
expression_statement (+21 nodes collapsed)
expression_statement (+21 nodes collapsed)
expression_statement (+21 nodes collapsed)
expression_statement (+21 nodes collapsed)
expression_statement (+21 nodes collapsed)
line_comment "// 2.0 only"
line_comment "//txt = txt.replaceAll(\"ry\", \"Ry\"); // 1.0 only"
expression_statement (+21 nodes collapsed)
expression_statement (+21 nodes collapsed)
expression_statement (+21 nodes collapsed)
line_comment "// 2.0 only"
line_comment "//txt = txt.replaceAll(\"ly\", \"Ly\"); // 1.0 only"
expression_statement (+21 nodes collapsed)
line_comment "//txt = txt.replaceAll(\"j\", \"y\"); // 1.0 only"
line_comment "//txt = txt.replaceAll(\"y3\", \"Y3\"); // 1.0 only"
line_comment "//txt = txt.replaceAll(\"y\", \"2\"); // 1.0 only"
line_comment "// 5. Handle removals"
expression_statement
assignment_expression
identifier "txt"
= "="
method_invocation
identifier "txt"
. "."
identifier "replaceAll"
argument_list
( "("
string_literal
" "\""
string_fragment "2"
" "\""
, ","
string_literal
" "\""
" "\""
) ")"
; ";"
expression_statement (+21 nodes collapsed)
line_comment "// 2.0 only"
expression_statement
assignment_expression
identifier "txt"
= "="
method_invocation
identifier "txt"
. "."
identifier "replaceAll"
argument_list
( "("
string_literal
" "\""
string_fragment "3"
" "\""
, ","
string_literal
" "\""
" "\""
) ")"
; ";"
line_comment "// 6. put ten 1s on the end"
expression_statement
assignment_expression
identifier "txt"
= "="
binary_expression
binary_expression
identifier "txt"
+ "+"
string_literal
" "\""
string_fragment "111111"
" "\""
+ "+"
string_literal
" "\""
string_fragment "1111"
" "\""
; ";"
line_comment "// 1.0 only has 6 1s"
line_comment "// 7. take the first six characters as the code"
return_statement
return "return"
method_invocation
identifier "txt"
. "."
identifier "substring"
argument_list
( "("
decimal_integer_literal "0"
, ","
decimal_integer_literal "10"
) ")"
; ";"
line_comment "// 1.0 truncates to 6"
} "}"
block_comment "/**\n * Encodes an Object using the caverphone algorithm."...
method_declaration (+66 nodes collapsed)
block_comment "/**\n * Encodes a String using the Caverphone algorithm. "...
method_declaration (+23 nodes collapsed)
block_comment "/**\n * Tests if the caverphones of two strings are ident"...
method_declaration (+39 nodes collapsed)
} "}"