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–377 unchanged (377 lines)
378
379 // build the name to index mappings
380 if (headerRecord != null) {
381 for (int i = 0; i < headerRecord.length; i++) {
382 final String header = headerRecord[i];
383 final boolean containsHeader = hdrMap.containsKey(header);
384 final boolean emptyHeader = header.trim().isEmpty();
385 if (containsHeader && (!emptyHeader || (emptyHeader && !this.format.getIgnoreEmptyHeaders()))) {
386 throw new IllegalArgumentException("The header contains a duplicate name: \"" + header +
387 "\" in " + Arrays.toString(headerRecord));
388 }
389 hdrMap.put(header, Integer.valueOf(i));
390 }
…lines 391–508 unchanged (118 lines)

After

…lines 1–377 unchanged (377 lines)
378
379 // build the name to index mappings
380 if (headerRecord != null) {
381 for (int i = 0; i < headerRecord.length; i++) {
382 final String header = headerRecord[i];
383 final boolean containsHeader = hdrMap.containsKey(header);
384 final boolean emptyHeader = header == null || header.trim().isEmpty();
385 if (containsHeader && (!emptyHeader || (emptyHeader && !this.format.getIgnoreEmptyHeaders()))) {
386 throw new IllegalArgumentException("The header contains a duplicate name: \"" + header +
387 "\" in " + Arrays.toString(headerRecord));
388 }
389 hdrMap.put(header, Integer.valueOf(i));
390 }
…lines 391–508 unchanged (118 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 "csv"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "io"
. "."
identifier "Closeable"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "io"
. "."
identifier "File"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "io"
. "."
identifier "FileInputStream"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "io"
. "."
identifier "FileReader"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "io"
. "."
identifier "IOException"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "io"
. "."
identifier "InputStreamReader"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "io"
. "."
identifier "Reader"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "io"
. "."
identifier "StringReader"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "net"
. "."
identifier "URL"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "nio"
. "."
identifier "charset"
. "."
identifier "Charset"
; ";"
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 "Collection"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "Iterator"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "LinkedHashMap"
; ";"
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 "Map"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "NoSuchElementException"
; ";"
import_declaration (+23 nodes collapsed)
block_comment "/**\n * Parses CSV files according to the specified format.\n "...
class_declaration
modifiers
public "public"
final "final"
class "class"
identifier "CSVParser"
super_interfaces
implements "implements"
type_list
generic_type
type_identifier "Iterable"
type_arguments
< "<"
type_identifier "CSVRecord"
> ">"
, ","
type_identifier "Closeable"
class_body
{ "{"
block_comment "/**\n * Creates a parser for the given {@link File}.\n "...
method_declaration (+89 nodes collapsed)
block_comment "/**\n * Creates a parser for the given {@link String}.\n "...
method_declaration (+74 nodes collapsed)
block_comment "/**\n * Creates a parser for the given URL.\n *\n *"...
method_declaration (+103 nodes collapsed)
line_comment "// the following objects are shared to reduce garbage"
field_declaration
modifiers
private "private"
final "final"
type_identifier "CSVFormat"
variable_declarator
identifier "format"
; ";"
block_comment "/** A mapping of column names to column indices */"
field_declaration
modifiers
private "private"
final "final"
generic_type
type_identifier "Map"
type_arguments
< "<"
type_identifier "String"
, ","
type_identifier "Integer"
> ">"
variable_declarator
identifier "headerMap"
; ";"
field_declaration
modifiers
private "private"
final "final"
type_identifier "Lexer"
variable_declarator
identifier "lexer"
; ";"
block_comment "/** A record buffer for getRecord(). Grows as necessary and "...
field_declaration (+25 nodes collapsed)
field_declaration
modifiers
private "private"
integral_type
long "long"
variable_declarator
identifier "recordNumber"
; ";"
field_declaration
modifiers
private "private"
final "final"
type_identifier "Token"
variable_declarator
identifier "reusableToken"
= "="
object_creation_expression
new "new"
type_identifier "Token"
argument_list
( "("
) ")"
; ";"
block_comment "/**\n * Customized CSV parser using the given {@link CSVF"...
constructor_declaration (+101 nodes collapsed)
method_declaration (+104 nodes collapsed)
block_comment "/**\n * Closes resources.\n *\n * @throws IOExcepti"...
method_declaration (+41 nodes collapsed)
block_comment "/**\n * Returns the current line number in the input stre"...
method_declaration (+25 nodes collapsed)
block_comment "/**\n * Returns a copy of the header map that iterates in"...
method_declaration (+49 nodes collapsed)
block_comment "/**\n * Returns the current record number in the input st"...
method_declaration
modifiers
public "public"
integral_type
long "long"
identifier "getRecordNumber"
formal_parameters
( "("
) ")"
block
{ "{"
return_statement
return "return"
field_access
this "this"
. "."
identifier "recordNumber"
; ";"
} "}"
block_comment "/**\n * Parses the CSV input according to the given forma"...
method_declaration (+38 nodes collapsed)
block_comment "/**\n * Parses the CSV input according to the given forma"...
method_declaration (+75 nodes collapsed)
block_comment "/**\n * Initializes the name to index mapping if the form"...
method_declaration
modifiers
private "private"
generic_type
type_identifier "Map"
type_arguments
< "<"
type_identifier "String"
, ","
type_identifier "Integer"
> ">"
identifier "initializeHeader"
formal_parameters
( "("
) ")"
throws
throws "throws"
type_identifier "IOException"
block
{ "{"
local_variable_declaration
generic_type
type_identifier "Map"
type_arguments
< "<"
type_identifier "String"
, ","
type_identifier "Integer"
> ">"
variable_declarator
identifier "hdrMap"
= "="
null_literal "null"
; ";"
local_variable_declaration (+22 nodes collapsed)
if_statement
if "if"
parenthesized_expression
( "("
binary_expression
identifier "formatHeader"
!= "!="
null_literal "null"
) ")"
block
{ "{"
expression_statement
assignment_expression
identifier "hdrMap"
= "="
object_creation_expression
new "new"
generic_type
type_identifier "LinkedHashMap"
type_arguments
< "<"
type_identifier "String"
, ","
type_identifier "Integer"
> ">"
argument_list
( "("
) ")"
; ";"
local_variable_declaration
array_type
type_identifier "String"
dimensions
[ "["
] "]"
variable_declarator
identifier "headerRecord"
= "="
null_literal "null"
; ";"
if_statement (+92 nodes collapsed)
line_comment "// build the name to index mappings"
if_statement
if "if"
parenthesized_expression
( "("
binary_expression
identifier "headerRecord"
!= "!="
null_literal "null"
) ")"
block
{ "{"
for_statement
for "for"
( "("
local_variable_declaration
integral_type
int "int"
variable_declarator
identifier "i"
= "="
decimal_integer_literal "0"
; ";"
binary_expression
identifier "i"
< "<"
field_access
identifier "headerRecord"
. "."
identifier "length"
; ";"
update_expression
identifier "i"
++ "++"
) ")"
block
{ "{"
local_variable_declaration
modifiers
final "final"
type_identifier "String"
variable_declarator
identifier "header"
= "="
array_access
identifier "headerRecord"
[ "["
identifier "i"
] "]"
; ";"
local_variable_declaration
modifiers
final "final"
boolean_type "boolean"
variable_declarator
identifier "containsHeader"
= "="
method_invocation
identifier "hdrMap"
. "."
identifier "containsKey"
argument_list
( "("
identifier "header"
) ")"
; ";"
local_variable_declaration
modifiers
final "final"
boolean_type "boolean"
variable_declarator
identifier "emptyHeader"
= "="
method_invocation
method_invocation
identifier "header"
. "."
identifier "trim"
argument_list
( "("
) ")"
. "."
identifier "isEmpty"
argument_list
( "("
) ")"
; ";"
if_statement (+71 nodes collapsed)
expression_statement
method_invocation
identifier "hdrMap"
. "."
identifier "put"
argument_list
( "("
identifier "header"
, ","
method_invocation
identifier "Integer"
. "."
identifier "valueOf"
argument_list
( "("
identifier "i"
) ")"
) ")"
; ";"
} "}"
} "}"
} "}"
return_statement
return "return"
identifier "hdrMap"
; ";"
} "}"
method_declaration (+24 nodes collapsed)
block_comment "/**\n * Returns an iterator on the records.\n *\n *"...
method_declaration (+301 nodes collapsed)
block_comment "/**\n * Parses the next record from the current point in "...
method_declaration (+409 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 "csv"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "io"
. "."
identifier "Closeable"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "io"
. "."
identifier "File"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "io"
. "."
identifier "FileInputStream"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "io"
. "."
identifier "FileReader"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "io"
. "."
identifier "IOException"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "io"
. "."
identifier "InputStreamReader"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "io"
. "."
identifier "Reader"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "io"
. "."
identifier "StringReader"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "net"
. "."
identifier "URL"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "nio"
. "."
identifier "charset"
. "."
identifier "Charset"
; ";"
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 "Collection"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "Iterator"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "LinkedHashMap"
; ";"
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 "Map"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "NoSuchElementException"
; ";"
import_declaration (+23 nodes collapsed)
block_comment "/**\n * Parses CSV files according to the specified format.\n "...
class_declaration
modifiers
public "public"
final "final"
class "class"
identifier "CSVParser"
super_interfaces
implements "implements"
type_list
generic_type
type_identifier "Iterable"
type_arguments
< "<"
type_identifier "CSVRecord"
> ">"
, ","
type_identifier "Closeable"
class_body
{ "{"
block_comment "/**\n * Creates a parser for the given {@link File}.\n "...
method_declaration (+89 nodes collapsed)
block_comment "/**\n * Creates a parser for the given {@link String}.\n "...
method_declaration (+74 nodes collapsed)
block_comment "/**\n * Creates a parser for the given URL.\n *\n *"...
method_declaration (+103 nodes collapsed)
line_comment "// the following objects are shared to reduce garbage"
field_declaration
modifiers
private "private"
final "final"
type_identifier "CSVFormat"
variable_declarator
identifier "format"
; ";"
block_comment "/** A mapping of column names to column indices */"
field_declaration
modifiers
private "private"
final "final"
generic_type
type_identifier "Map"
type_arguments
< "<"
type_identifier "String"
, ","
type_identifier "Integer"
> ">"
variable_declarator
identifier "headerMap"
; ";"
field_declaration
modifiers
private "private"
final "final"
type_identifier "Lexer"
variable_declarator
identifier "lexer"
; ";"
block_comment "/** A record buffer for getRecord(). Grows as necessary and "...
field_declaration (+25 nodes collapsed)
field_declaration
modifiers
private "private"
integral_type
long "long"
variable_declarator
identifier "recordNumber"
; ";"
field_declaration
modifiers
private "private"
final "final"
type_identifier "Token"
variable_declarator
identifier "reusableToken"
= "="
object_creation_expression
new "new"
type_identifier "Token"
argument_list
( "("
) ")"
; ";"
block_comment "/**\n * Customized CSV parser using the given {@link CSVF"...
constructor_declaration (+101 nodes collapsed)
method_declaration (+104 nodes collapsed)
block_comment "/**\n * Closes resources.\n *\n * @throws IOExcepti"...
method_declaration (+41 nodes collapsed)
block_comment "/**\n * Returns the current line number in the input stre"...
method_declaration (+25 nodes collapsed)
block_comment "/**\n * Returns a copy of the header map that iterates in"...
method_declaration (+49 nodes collapsed)
block_comment "/**\n * Returns the current record number in the input st"...
method_declaration
modifiers
public "public"
integral_type
long "long"
identifier "getRecordNumber"
formal_parameters
( "("
) ")"
block
{ "{"
return_statement
return "return"
field_access
this "this"
. "."
identifier "recordNumber"
; ";"
} "}"
block_comment "/**\n * Parses the CSV input according to the given forma"...
method_declaration (+38 nodes collapsed)
block_comment "/**\n * Parses the CSV input according to the given forma"...
method_declaration (+75 nodes collapsed)
block_comment "/**\n * Initializes the name to index mapping if the form"...
method_declaration
modifiers
private "private"
generic_type
type_identifier "Map"
type_arguments
< "<"
type_identifier "String"
, ","
type_identifier "Integer"
> ">"
identifier "initializeHeader"
formal_parameters
( "("
) ")"
throws
throws "throws"
type_identifier "IOException"
block
{ "{"
local_variable_declaration
generic_type
type_identifier "Map"
type_arguments
< "<"
type_identifier "String"
, ","
type_identifier "Integer"
> ">"
variable_declarator
identifier "hdrMap"
= "="
null_literal "null"
; ";"
local_variable_declaration (+22 nodes collapsed)
if_statement
if "if"
parenthesized_expression
( "("
binary_expression
identifier "formatHeader"
!= "!="
null_literal "null"
) ")"
block
{ "{"
expression_statement
assignment_expression
identifier "hdrMap"
= "="
object_creation_expression
new "new"
generic_type
type_identifier "LinkedHashMap"
type_arguments
< "<"
type_identifier "String"
, ","
type_identifier "Integer"
> ">"
argument_list
( "("
) ")"
; ";"
local_variable_declaration
array_type
type_identifier "String"
dimensions
[ "["
] "]"
variable_declarator
identifier "headerRecord"
= "="
null_literal "null"
; ";"
if_statement (+92 nodes collapsed)
line_comment "// build the name to index mappings"
if_statement
if "if"
parenthesized_expression
( "("
binary_expression
identifier "headerRecord"
!= "!="
null_literal "null"
) ")"
block
{ "{"
for_statement
for "for"
( "("
local_variable_declaration
integral_type
int "int"
variable_declarator
identifier "i"
= "="
decimal_integer_literal "0"
; ";"
binary_expression
identifier "i"
< "<"
field_access
identifier "headerRecord"
. "."
identifier "length"
; ";"
update_expression
identifier "i"
++ "++"
) ")"
block
{ "{"
local_variable_declaration
modifiers
final "final"
type_identifier "String"
variable_declarator
identifier "header"
= "="
array_access
identifier "headerRecord"
[ "["
identifier "i"
] "]"
; ";"
local_variable_declaration
modifiers
final "final"
boolean_type "boolean"
variable_declarator
identifier "containsHeader"
= "="
method_invocation
identifier "hdrMap"
. "."
identifier "containsKey"
argument_list
( "("
identifier "header"
) ")"
; ";"
local_variable_declaration
modifiers
final "final"
boolean_type "boolean"
variable_declarator
identifier "emptyHeader"
= "="
binary_expression
binary_expression
identifier "header"
== "=="
null_literal "null"
|| "||"
method_invocation
method_invocation
identifier "header"
. "."
identifier "trim"
argument_list
( "("
) ")"
. "."
identifier "isEmpty"
argument_list
( "("
) ")"
; ";"
if_statement (+71 nodes collapsed)
expression_statement
method_invocation
identifier "hdrMap"
. "."
identifier "put"
argument_list
( "("
identifier "header"
, ","
method_invocation
identifier "Integer"
. "."
identifier "valueOf"
argument_list
( "("
identifier "i"
) ")"
) ")"
; ";"
} "}"
} "}"
} "}"
return_statement
return "return"
identifier "hdrMap"
; ";"
} "}"
method_declaration (+24 nodes collapsed)
block_comment "/**\n * Returns an iterator on the records.\n *\n *"...
method_declaration (+301 nodes collapsed)
block_comment "/**\n * Parses the next record from the current point in "...
method_declaration (+409 nodes collapsed)
} "}"