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–107 unchanged (107 lines)
108 return new Locale(str, "");
109 } else {
110 if (str.charAt(2) != '_') {
111 throw new IllegalArgumentException("Invalid locale format: " + str);
112 }
113 char ch3 = str.charAt(3);
114 char ch4 = str.charAt(4);
115 if (ch3 < 'A' || ch3 > 'Z' || ch4 < 'A' || ch4 > 'Z') {
116 throw new IllegalArgumentException("Invalid locale format: " + str);
117 }
118 if (len == 5) {
119 return new Locale(str.substring(0, 2), str.substring(3, 5));
120 } else {
…lines 121–292 unchanged (172 lines)

After

…lines 1–107 unchanged (107 lines)
108 return new Locale(str, "");
109 } else {
110 if (str.charAt(2) != '_') {
111 throw new IllegalArgumentException("Invalid locale format: " + str);
112 }
113 char ch3 = str.charAt(3);
114 if (ch3 == '_') {
115 return new Locale(str.substring(0, 2), "", str.substring(4));
116 }
117 char ch4 = str.charAt(4);
118 if (ch3 < 'A' || ch3 > 'Z' || ch4 < 'A' || ch4 > 'Z') {
119 throw new IllegalArgumentException("Invalid locale format: " + str);
120 }
121 if (len == 5) {
122 return new Locale(str.substring(0, 2), str.substring(3, 5));
…lines 123–295 unchanged (173 lines)

Before

program
block_comment "/*\n * Licensed to the Apache Software Foundation (ASF) under"...
package_declaration
package "package"
scoped_identifier
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "apache"
. "."
identifier "commons"
. "."
identifier "lang"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "ArrayList"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "Arrays"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "Collections"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "HashMap"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "HashSet"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "List"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "Locale"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "Map"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "Set"
; ";"
block_comment "/**\n * <p>Operations to assist when working with a {@link Lo"...
class_declaration
modifiers
public "public"
class "class"
identifier "LocaleUtils"
class_body
{ "{"
block_comment "/** Unmodifiable list of available locales. */"
field_declaration
modifiers
private "private"
static "static"
final "final"
type_identifier "List"
variable_declarator
identifier "cAvailableLocaleList"
; ";"
block_comment "/** Unmodifiable set of available locales. */"
field_declaration
modifiers
private "private"
static "static"
type_identifier "Set"
variable_declarator
identifier "cAvailableLocaleSet"
; ";"
block_comment "/** Unmodifiable map of language locales by country. */"
field_declaration (+23 nodes collapsed)
block_comment "/** Unmodifiable map of country locales by language. */"
field_declaration (+23 nodes collapsed)
static_initializer (+38 nodes collapsed)
block_comment "/**\n * <p><code>LocaleUtils</code> instances should NOT "...
constructor_declaration
modifiers
public "public"
identifier "LocaleUtils"
formal_parameters
( "("
) ")"
constructor_body
{ "{"
explicit_constructor_invocation
super "super"
argument_list
( "("
) ")"
; ";"
} "}"
line_comment "//----------------------------------------------------------"...
block_comment "/**\n * <p>Converts a String to a Locale.</p>\n *\n "...
method_declaration
modifiers
public "public"
static "static"
type_identifier "Locale"
identifier "toLocale"
formal_parameters
( "("
formal_parameter
type_identifier "String"
identifier "str"
) ")"
block
{ "{"
if_statement
if "if"
parenthesized_expression
( "("
binary_expression
identifier "str"
== "=="
null_literal "null"
) ")"
block
{ "{"
return_statement
return "return"
null_literal "null"
; ";"
} "}"
local_variable_declaration
integral_type
int "int"
variable_declarator
identifier "len"
= "="
method_invocation
identifier "str"
. "."
identifier "length"
argument_list
( "("
) ")"
; ";"
if_statement (+40 nodes collapsed)
local_variable_declaration
integral_type
char "char"
variable_declarator
identifier "ch0"
= "="
method_invocation
identifier "str"
. "."
identifier "charAt"
argument_list
( "("
decimal_integer_literal "0"
) ")"
; ";"
local_variable_declaration
integral_type
char "char"
variable_declarator
identifier "ch1"
= "="
method_invocation
identifier "str"
. "."
identifier "charAt"
argument_list
( "("
decimal_integer_literal "1"
) ")"
; ";"
if_statement (+46 nodes collapsed)
if_statement
if "if"
parenthesized_expression
( "("
binary_expression
identifier "len"
== "=="
decimal_integer_literal "2"
) ")"
block
{ "{"
return_statement
return "return"
object_creation_expression
new "new"
type_identifier "Locale"
argument_list
( "("
identifier "str"
, ","
string_literal
" "\""
" "\""
) ")"
; ";"
} "}"
else "else"
block
{ "{"
if_statement (+35 nodes collapsed)
local_variable_declaration
integral_type
char "char"
variable_declarator
identifier "ch3"
= "="
method_invocation
identifier "str"
. "."
identifier "charAt"
argument_list
( "("
decimal_integer_literal "3"
) ")"
; ";"
local_variable_declaration
integral_type
char "char"
variable_declarator
identifier "ch4"
= "="
method_invocation
identifier "str"
. "."
identifier "charAt"
argument_list
( "("
decimal_integer_literal "4"
) ")"
; ";"
if_statement (+46 nodes collapsed)
if_statement (+120 nodes collapsed)
} "}"
} "}"
line_comment "//----------------------------------------------------------"...
block_comment "/**\n * <p>Obtains the list of locales to search through "...
method_declaration (+26 nodes collapsed)
line_comment "//----------------------------------------------------------"...
block_comment "/**\n * <p>Obtains the list of locales to search through "...
method_declaration (+198 nodes collapsed)
line_comment "//----------------------------------------------------------"...
block_comment "/**\n * <p>Obtains an unmodifiable list of installed loca"...
method_declaration
modifiers
public "public"
static "static"
type_identifier "List"
identifier "availableLocaleList"
formal_parameters
( "("
) ")"
block
{ "{"
return_statement
return "return"
identifier "cAvailableLocaleList"
; ";"
} "}"
line_comment "//----------------------------------------------------------"...
block_comment "/**\n * <p>Obtains an unmodifiable set of installed local"...
method_declaration (+70 nodes collapsed)
line_comment "//----------------------------------------------------------"...
block_comment "/**\n * <p>Checks if the locale specified is in the list "...
method_declaration (+30 nodes collapsed)
line_comment "//----------------------------------------------------------"...
block_comment "/**\n * <p>Obtains the list of languages supported for a "...
method_declaration (+220 nodes collapsed)
line_comment "//----------------------------------------------------------"...
block_comment "/**\n * <p>Obtains the list of countries supported for a "...
method_declaration (+238 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
identifier "org"
. "."
identifier "apache"
. "."
identifier "commons"
. "."
identifier "lang"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "ArrayList"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "Arrays"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "Collections"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "HashMap"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "HashSet"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "List"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "Locale"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "Map"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "Set"
; ";"
block_comment "/**\n * <p>Operations to assist when working with a {@link Lo"...
class_declaration
modifiers
public "public"
class "class"
identifier "LocaleUtils"
class_body
{ "{"
block_comment "/** Unmodifiable list of available locales. */"
field_declaration
modifiers
private "private"
static "static"
final "final"
type_identifier "List"
variable_declarator
identifier "cAvailableLocaleList"
; ";"
block_comment "/** Unmodifiable set of available locales. */"
field_declaration
modifiers
private "private"
static "static"
type_identifier "Set"
variable_declarator
identifier "cAvailableLocaleSet"
; ";"
block_comment "/** Unmodifiable map of language locales by country. */"
field_declaration (+23 nodes collapsed)
block_comment "/** Unmodifiable map of country locales by language. */"
field_declaration (+23 nodes collapsed)
static_initializer (+38 nodes collapsed)
block_comment "/**\n * <p><code>LocaleUtils</code> instances should NOT "...
constructor_declaration
modifiers
public "public"
identifier "LocaleUtils"
formal_parameters
( "("
) ")"
constructor_body
{ "{"
explicit_constructor_invocation
super "super"
argument_list
( "("
) ")"
; ";"
} "}"
line_comment "//----------------------------------------------------------"...
block_comment "/**\n * <p>Converts a String to a Locale.</p>\n *\n "...
method_declaration
modifiers
public "public"
static "static"
type_identifier "Locale"
identifier "toLocale"
formal_parameters
( "("
formal_parameter
type_identifier "String"
identifier "str"
) ")"
block
{ "{"
if_statement
if "if"
parenthesized_expression
( "("
binary_expression
identifier "str"
== "=="
null_literal "null"
) ")"
block
{ "{"
return_statement
return "return"
null_literal "null"
; ";"
} "}"
local_variable_declaration
integral_type
int "int"
variable_declarator
identifier "len"
= "="
method_invocation
identifier "str"
. "."
identifier "length"
argument_list
( "("
) ")"
; ";"
if_statement (+40 nodes collapsed)
local_variable_declaration
integral_type
char "char"
variable_declarator
identifier "ch0"
= "="
method_invocation
identifier "str"
. "."
identifier "charAt"
argument_list
( "("
decimal_integer_literal "0"
) ")"
; ";"
local_variable_declaration
integral_type
char "char"
variable_declarator
identifier "ch1"
= "="
method_invocation
identifier "str"
. "."
identifier "charAt"
argument_list
( "("
decimal_integer_literal "1"
) ")"
; ";"
if_statement (+46 nodes collapsed)
if_statement
if "if"
parenthesized_expression
( "("
binary_expression
identifier "len"
== "=="
decimal_integer_literal "2"
) ")"
block
{ "{"
return_statement
return "return"
object_creation_expression
new "new"
type_identifier "Locale"
argument_list
( "("
identifier "str"
, ","
string_literal
" "\""
" "\""
) ")"
; ";"
} "}"
else "else"
block
{ "{"
if_statement (+35 nodes collapsed)
local_variable_declaration
integral_type
char "char"
variable_declarator
identifier "ch3"
= "="
method_invocation
identifier "str"
. "."
identifier "charAt"
argument_list
( "("
decimal_integer_literal "3"
) ")"
; ";"
if_statement
if "if"
parenthesized_expression
( "("
binary_expression
identifier "ch3"
== "=="
character_literal "'_'"
) ")"
block
{ "{"
return_statement
return "return"
object_creation_expression
new "new"
type_identifier "Locale"
argument_list
( "("
method_invocation
identifier "str"
. "."
identifier "substring"
argument_list
( "("
decimal_integer_literal "0"
, ","
decimal_integer_literal "2"
) ")"
, ","
string_literal
" "\""
" "\""
, ","
method_invocation
identifier "str"
. "."
identifier "substring"
argument_list
( "("
decimal_integer_literal "4"
) ")"
) ")"
; ";"
} "}"
local_variable_declaration
integral_type
char "char"
variable_declarator
identifier "ch4"
= "="
method_invocation
identifier "str"
. "."
identifier "charAt"
argument_list
( "("
decimal_integer_literal "4"
) ")"
; ";"
if_statement (+46 nodes collapsed)
if_statement (+120 nodes collapsed)
} "}"
} "}"
line_comment "//----------------------------------------------------------"...
block_comment "/**\n * <p>Obtains the list of locales to search through "...
method_declaration (+26 nodes collapsed)
line_comment "//----------------------------------------------------------"...
block_comment "/**\n * <p>Obtains the list of locales to search through "...
method_declaration (+198 nodes collapsed)
line_comment "//----------------------------------------------------------"...
block_comment "/**\n * <p>Obtains an unmodifiable list of installed loca"...
method_declaration
modifiers
public "public"
static "static"
type_identifier "List"
identifier "availableLocaleList"
formal_parameters
( "("
) ")"
block
{ "{"
return_statement
return "return"
identifier "cAvailableLocaleList"
; ";"
} "}"
line_comment "//----------------------------------------------------------"...
block_comment "/**\n * <p>Obtains an unmodifiable set of installed local"...
method_declaration (+70 nodes collapsed)
line_comment "//----------------------------------------------------------"...
block_comment "/**\n * <p>Checks if the locale specified is in the list "...
method_declaration (+30 nodes collapsed)
line_comment "//----------------------------------------------------------"...
block_comment "/**\n * <p>Obtains the list of languages supported for a "...
method_declaration (+220 nodes collapsed)
line_comment "//----------------------------------------------------------"...
block_comment "/**\n * <p>Obtains the list of countries supported for a "...
method_declaration (+238 nodes collapsed)
} "}"