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–81 unchanged (81 lines)
82 boolean hard = false ;
83 if ((txt == null) || (txt.length() == 0)) {
84 return "" ;
85 }
86 // single character is itself
87 if (txt.length() == 1) {
88 return txt.toUpperCase() ;
89 }
90
91 char[] inwd = txt.toUpperCase(java.util.Locale.ENGLISH).toCharArray() ;
92
93 StringBuffer local = new StringBuffer(40); // manipulate
94 StringBuffer code = new StringBuffer(10) ; // output
…lines 95–406 unchanged (312 lines)

After

…lines 1–81 unchanged (81 lines)
82 boolean hard = false ;
83 if ((txt == null) || (txt.length() == 0)) {
84 return "" ;
85 }
86 // single character is itself
87 if (txt.length() == 1) {
88 return txt.toUpperCase(java.util.Locale.ENGLISH) ;
89 }
90
91 char[] inwd = txt.toUpperCase(java.util.Locale.ENGLISH).toCharArray() ;
92
93 StringBuffer local = new StringBuffer(40); // manipulate
94 StringBuffer code = new StringBuffer(10) ; // output
…lines 95–406 unchanged (312 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 metaphone value. \n * <p>\n * I"...
class_declaration
modifiers
public "public"
class "class"
identifier "Metaphone"
super_interfaces
implements "implements"
type_list
type_identifier "StringEncoder"
class_body
{ "{"
block_comment "/**\n * Five values in the English language \n */"
field_declaration
modifiers
private "private"
static "static"
final "final"
type_identifier "String"
variable_declarator
identifier "VOWELS"
= "="
string_literal
" "\""
string_fragment "AEIOU"
" "\""
; ";"
block_comment "/**\n * Variable used in Metaphone algorithm\n */"
field_declaration
modifiers
private "private"
static "static"
final "final"
type_identifier "String"
variable_declarator
identifier "FRONTV"
= "="
string_literal
" "\""
string_fragment "EIY"
" "\""
; ";"
block_comment "/**\n * Variable used in Metaphone algorithm\n */"
field_declaration
modifiers
private "private"
static "static"
final "final"
type_identifier "String"
variable_declarator
identifier "VARSON"
= "="
string_literal
" "\""
string_fragment "CSPTG"
" "\""
; ";"
block_comment "/**\n * The max code length for metaphone is 4\n */"
field_declaration
modifiers
private "private"
integral_type
int "int"
variable_declarator
identifier "maxCodeLen"
= "="
decimal_integer_literal "4"
; ";"
block_comment "/**\n * Creates an instance of the Metaphone encoder\n "...
constructor_declaration
modifiers
public "public"
identifier "Metaphone"
formal_parameters
( "("
) ")"
constructor_body
{ "{"
explicit_constructor_invocation
super "super"
argument_list
( "("
) ")"
; ";"
} "}"
block_comment "/**\n * Find the metaphone value of a String. This is sim"...
method_declaration
modifiers
public "public"
type_identifier "String"
identifier "metaphone"
formal_parameters
( "("
formal_parameter
type_identifier "String"
identifier "txt"
) ")"
block
{ "{"
local_variable_declaration
boolean_type "boolean"
variable_declarator
identifier "hard"
= "="
false "false"
; ";"
if_statement (+36 nodes collapsed)
line_comment "// single character is itself"
if_statement
if "if"
parenthesized_expression
( "("
binary_expression
method_invocation
identifier "txt"
. "."
identifier "length"
argument_list
( "("
) ")"
== "=="
decimal_integer_literal "1"
) ")"
block
{ "{"
return_statement
return "return"
method_invocation
identifier "txt"
. "."
identifier "toUpperCase"
argument_list
( "("
) ")"
; ";"
} "}"
local_variable_declaration (+34 nodes collapsed)
local_variable_declaration
type_identifier "StringBuffer"
variable_declarator
identifier "local"
= "="
object_creation_expression
new "new"
type_identifier "StringBuffer"
argument_list
( "("
decimal_integer_literal "40"
) ")"
; ";"
line_comment "// manipulate"
local_variable_declaration
type_identifier "StringBuffer"
variable_declarator
identifier "code"
= "="
object_creation_expression
new "new"
type_identifier "StringBuffer"
argument_list
( "("
decimal_integer_literal "10"
) ")"
; ";"
line_comment "// output"
line_comment "// handle initial 2 characters exceptions"
switch_expression (+296 nodes collapsed)
line_comment "// now local has working string with initials fixed"
local_variable_declaration
integral_type
int "int"
variable_declarator
identifier "wdsz"
= "="
method_invocation
identifier "local"
. "."
identifier "length"
argument_list
( "("
) ")"
; ";"
local_variable_declaration
integral_type
int "int"
variable_declarator
identifier "n"
= "="
decimal_integer_literal "0"
; ";"
while_statement (+1513 nodes collapsed)
return_statement
return "return"
method_invocation
identifier "code"
. "."
identifier "toString"
argument_list
( "("
) ")"
; ";"
} "}"
method_declaration (+40 nodes collapsed)
method_declaration (+78 nodes collapsed)
method_declaration (+81 nodes collapsed)
method_declaration (+111 nodes collapsed)
method_declaration (+30 nodes collapsed)
block_comment "/**\n * Encodes an Object using the metaphone algorithm. "...
method_declaration (+66 nodes collapsed)
block_comment "/**\n * Encodes a String using the Metaphone algorithm. \n"...
method_declaration (+23 nodes collapsed)
block_comment "/**\n * Tests is the metaphones of two strings are identi"...
method_declaration (+39 nodes collapsed)
block_comment "/**\n * Returns the maxCodeLen.\n * @return int\n *"...
method_declaration
modifiers
public "public"
integral_type
int "int"
identifier "getMaxCodeLen"
formal_parameters
( "("
) ")"
block
{ "{"
return_statement
return "return"
field_access
this "this"
. "."
identifier "maxCodeLen"
; ";"
} "}"
block_comment "/**\n * Sets the maxCodeLen.\n * @param maxCodeLen The"...
method_declaration (+24 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 metaphone value. \n * <p>\n * I"...
class_declaration
modifiers
public "public"
class "class"
identifier "Metaphone"
super_interfaces
implements "implements"
type_list
type_identifier "StringEncoder"
class_body
{ "{"
block_comment "/**\n * Five values in the English language \n */"
field_declaration
modifiers
private "private"
static "static"
final "final"
type_identifier "String"
variable_declarator
identifier "VOWELS"
= "="
string_literal
" "\""
string_fragment "AEIOU"
" "\""
; ";"
block_comment "/**\n * Variable used in Metaphone algorithm\n */"
field_declaration
modifiers
private "private"
static "static"
final "final"
type_identifier "String"
variable_declarator
identifier "FRONTV"
= "="
string_literal
" "\""
string_fragment "EIY"
" "\""
; ";"
block_comment "/**\n * Variable used in Metaphone algorithm\n */"
field_declaration
modifiers
private "private"
static "static"
final "final"
type_identifier "String"
variable_declarator
identifier "VARSON"
= "="
string_literal
" "\""
string_fragment "CSPTG"
" "\""
; ";"
block_comment "/**\n * The max code length for metaphone is 4\n */"
field_declaration
modifiers
private "private"
integral_type
int "int"
variable_declarator
identifier "maxCodeLen"
= "="
decimal_integer_literal "4"
; ";"
block_comment "/**\n * Creates an instance of the Metaphone encoder\n "...
constructor_declaration
modifiers
public "public"
identifier "Metaphone"
formal_parameters
( "("
) ")"
constructor_body
{ "{"
explicit_constructor_invocation
super "super"
argument_list
( "("
) ")"
; ";"
} "}"
block_comment "/**\n * Find the metaphone value of a String. This is sim"...
method_declaration
modifiers
public "public"
type_identifier "String"
identifier "metaphone"
formal_parameters
( "("
formal_parameter
type_identifier "String"
identifier "txt"
) ")"
block
{ "{"
local_variable_declaration
boolean_type "boolean"
variable_declarator
identifier "hard"
= "="
false "false"
; ";"
if_statement (+36 nodes collapsed)
line_comment "// single character is itself"
if_statement
if "if"
parenthesized_expression
( "("
binary_expression
method_invocation
identifier "txt"
. "."
identifier "length"
argument_list
( "("
) ")"
== "=="
decimal_integer_literal "1"
) ")"
block
{ "{"
return_statement
return "return"
method_invocation
identifier "txt"
. "."
identifier "toUpperCase"
argument_list
( "("
field_access
field_access
field_access
identifier "java"
. "."
identifier "util"
. "."
identifier "Locale"
. "."
identifier "ENGLISH"
) ")"
; ";"
} "}"
local_variable_declaration (+34 nodes collapsed)
local_variable_declaration
type_identifier "StringBuffer"
variable_declarator
identifier "local"
= "="
object_creation_expression
new "new"
type_identifier "StringBuffer"
argument_list
( "("
decimal_integer_literal "40"
) ")"
; ";"
line_comment "// manipulate"
local_variable_declaration
type_identifier "StringBuffer"
variable_declarator
identifier "code"
= "="
object_creation_expression
new "new"
type_identifier "StringBuffer"
argument_list
( "("
decimal_integer_literal "10"
) ")"
; ";"
line_comment "// output"
line_comment "// handle initial 2 characters exceptions"
switch_expression (+296 nodes collapsed)
line_comment "// now local has working string with initials fixed"
local_variable_declaration
integral_type
int "int"
variable_declarator
identifier "wdsz"
= "="
method_invocation
identifier "local"
. "."
identifier "length"
argument_list
( "("
) ")"
; ";"
local_variable_declaration
integral_type
int "int"
variable_declarator
identifier "n"
= "="
decimal_integer_literal "0"
; ";"
while_statement (+1513 nodes collapsed)
return_statement
return "return"
method_invocation
identifier "code"
. "."
identifier "toString"
argument_list
( "("
) ")"
; ";"
} "}"
method_declaration (+40 nodes collapsed)
method_declaration (+78 nodes collapsed)
method_declaration (+81 nodes collapsed)
method_declaration (+111 nodes collapsed)
method_declaration (+30 nodes collapsed)
block_comment "/**\n * Encodes an Object using the metaphone algorithm. "...
method_declaration (+66 nodes collapsed)
block_comment "/**\n * Encodes a String using the Metaphone algorithm. \n"...
method_declaration (+23 nodes collapsed)
block_comment "/**\n * Tests is the metaphones of two strings are identi"...
method_declaration (+39 nodes collapsed)
block_comment "/**\n * Returns the maxCodeLen.\n * @return int\n *"...
method_declaration
modifiers
public "public"
integral_type
int "int"
identifier "getMaxCodeLen"
formal_parameters
( "("
) ")"
block
{ "{"
return_statement
return "return"
field_access
this "this"
. "."
identifier "maxCodeLen"
; ";"
} "}"
block_comment "/**\n * Sets the maxCodeLen.\n * @param maxCodeLen The"...
method_declaration (+24 nodes collapsed)
} "}"