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–243 unchanged (243 lines)
244
245 for (final Iterator i = options.iterator(); i.hasNext();) {
246 final Option option = (Option) i.next();
247
248 // needs validation?
249 boolean validate = option.isRequired() || option instanceof Group;
250 if (validate) {
251 option.validate(commandLine);
252 }
253
254 // if the child option is present then validate it
255 if (commandLine.hasOption(option)) {
256 if (++present > maximum) {
257 unexpected = option;
258
259 break;
260 }
261
262 option.validate(commandLine);
263 }
264 }
265
266 // too many options
267 if (unexpected != null) {
268 throw new OptionException(this, ResourceConstants.UNEXPECTED_TOKEN,
…lines 269–515 unchanged (247 lines)

After

…lines 1–251 unchanged (251 lines)
252 if (commandLine.hasOption(option)) {
253 if (++present > maximum) {
254 unexpected = option;
255
256 break;
257 }
258 validate = true;
259 }
260
261 if (validate) {
262 option.validate(commandLine);
263 }
264 }
265
266 // too many options
267 if (unexpected != null) {
268 throw new OptionException(this, ResourceConstants.UNEXPECTED_TOKEN,
269 unexpected.getPreferredName());
…lines 270–515 unchanged (246 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 "cli2"
. "."
identifier "option"
; ";"
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 "Collection"
; ";"
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 "Comparator"
; ";"
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 "Iterator"
; ";"
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 "ListIterator"
; ";"
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"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "SortedMap"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "TreeMap"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "apache"
. "."
identifier "commons"
. "."
identifier "cli2"
. "."
identifier "Argument"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "apache"
. "."
identifier "commons"
. "."
identifier "cli2"
. "."
identifier "DisplaySetting"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "apache"
. "."
identifier "commons"
. "."
identifier "cli2"
. "."
identifier "Group"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "apache"
. "."
identifier "commons"
. "."
identifier "cli2"
. "."
identifier "HelpLine"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "apache"
. "."
identifier "commons"
. "."
identifier "cli2"
. "."
identifier "Option"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "apache"
. "."
identifier "commons"
. "."
identifier "cli2"
. "."
identifier "OptionException"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "apache"
. "."
identifier "commons"
. "."
identifier "cli2"
. "."
identifier "WriteableCommandLine"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "apache"
. "."
identifier "commons"
. "."
identifier "cli2"
. "."
identifier "resource"
. "."
identifier "ResourceConstants"
; ";"
block_comment "/**\n * An implementation of Group\n */"
class_declaration
modifiers
public "public"
class "class"
identifier "GroupImpl"
superclass
extends "extends"
type_identifier "OptionImpl"
super_interfaces
implements "implements"
type_list
type_identifier "Group"
class_body
{ "{"
field_declaration
modifiers
private "private"
final "final"
type_identifier "String"
variable_declarator
identifier "name"
; ";"
field_declaration
modifiers
private "private"
final "final"
type_identifier "String"
variable_declarator
identifier "description"
; ";"
field_declaration
modifiers
private "private"
final "final"
type_identifier "List"
variable_declarator
identifier "options"
; ";"
field_declaration
modifiers
private "private"
final "final"
integral_type
int "int"
variable_declarator
identifier "minimum"
; ";"
field_declaration
modifiers
private "private"
final "final"
integral_type
int "int"
variable_declarator
identifier "maximum"
; ";"
field_declaration
modifiers
private "private"
final "final"
type_identifier "List"
variable_declarator
identifier "anonymous"
; ";"
field_declaration
modifiers
private "private"
final "final"
type_identifier "SortedMap"
variable_declarator
identifier "optionMap"
; ";"
field_declaration
modifiers
private "private"
final "final"
type_identifier "Set"
variable_declarator
identifier "prefixes"
; ";"
block_comment "/**\n * Creates a new GroupImpl using the specified param"...
constructor_declaration (+367 nodes collapsed)
method_declaration (+201 nodes collapsed)
method_declaration
modifiers
public "public"
type_identifier "Set"
identifier "getPrefixes"
formal_parameters
( "("
) ")"
block
{ "{"
return_statement
return "return"
identifier "prefixes"
; ";"
} "}"
method_declaration (+21 nodes collapsed)
method_declaration (+449 nodes collapsed)
method_declaration
modifiers
public "public"
void_type "void"
identifier "validate"
formal_parameters
( "("
formal_parameter
modifiers
final "final"
type_identifier "WriteableCommandLine"
identifier "commandLine"
) ")"
throws
throws "throws"
type_identifier "OptionException"
block
{ "{"
line_comment "// number of options found"
local_variable_declaration
integral_type
int "int"
variable_declarator
identifier "present"
= "="
decimal_integer_literal "0"
; ";"
line_comment "// reference to first unexpected option"
local_variable_declaration
type_identifier "Option"
variable_declarator
identifier "unexpected"
= "="
null_literal "null"
; ";"
for_statement
for "for"
( "("
local_variable_declaration
modifiers
final "final"
type_identifier "Iterator"
variable_declarator
identifier "i"
= "="
method_invocation
identifier "options"
. "."
identifier "iterator"
argument_list
( "("
) ")"
; ";"
method_invocation
identifier "i"
. "."
identifier "hasNext"
argument_list
( "("
) ")"
; ";"
) ")"
block
{ "{"
local_variable_declaration
modifiers
final "final"
type_identifier "Option"
variable_declarator
identifier "option"
= "="
cast_expression
( "("
type_identifier "Option"
) ")"
method_invocation
identifier "i"
. "."
identifier "next"
argument_list
( "("
) ")"
; ";"
line_comment "// needs validation?"
local_variable_declaration
boolean_type "boolean"
variable_declarator
identifier "validate"
= "="
binary_expression
method_invocation
identifier "option"
. "."
identifier "isRequired"
argument_list
( "("
) ")"
|| "||"
instanceof_expression
identifier "option"
instanceof "instanceof"
type_identifier "Group"
; ";"
if_statement
if "if"
parenthesized_expression
( "("
identifier "validate"
) ")"
block
{ "{"
expression_statement
method_invocation
identifier "option"
. "."
identifier "validate"
argument_list
( "("
identifier "commandLine"
) ")"
; ";"
} "}"
line_comment "// if the child option is present then validate it"
if_statement
if "if"
parenthesized_expression
( "("
method_invocation
identifier "commandLine"
. "."
identifier "hasOption"
argument_list
( "("
identifier "option"
) ")"
) ")"
block
{ "{"
if_statement (+23 nodes collapsed)
expression_statement
method_invocation
identifier "option"
. "."
identifier "validate"
argument_list
( "("
identifier "commandLine"
) ")"
; ";"
} "}"
} "}"
line_comment "// too many options"
if_statement (+35 nodes collapsed)
line_comment "// too few option"
if_statement (+27 nodes collapsed)
line_comment "// validate each anonymous argument"
for_statement (+59 nodes collapsed)
} "}"
method_declaration
modifiers
public "public"
type_identifier "String"
identifier "getPreferredName"
formal_parameters
( "("
) ")"
block
{ "{"
return_statement
return "return"
identifier "name"
; ";"
} "}"
method_declaration
modifiers
public "public"
type_identifier "String"
identifier "getDescription"
formal_parameters
( "("
) ")"
block
{ "{"
return_statement
return "return"
identifier "description"
; ";"
} "}"
method_declaration (+45 nodes collapsed)
method_declaration (+633 nodes collapsed)
method_declaration (+334 nodes collapsed)
block_comment "/**\n * Gets the member Options of thie Group.\n * Not"...
method_declaration
modifiers
public "public"
type_identifier "List"
identifier "getOptions"
formal_parameters
( "("
) ")"
block
{ "{"
return_statement
return "return"
identifier "options"
; ";"
} "}"
block_comment "/**\n * Gets the anonymous Arguments of this Group.\n "...
method_declaration
modifiers
public "public"
type_identifier "List"
identifier "getAnonymous"
formal_parameters
( "("
) ")"
block
{ "{"
return_statement
return "return"
identifier "anonymous"
; ";"
} "}"
method_declaration (+105 nodes collapsed)
method_declaration
modifiers
public "public"
integral_type
int "int"
identifier "getMinimum"
formal_parameters
( "("
) ")"
block
{ "{"
return_statement
return "return"
identifier "minimum"
; ";"
} "}"
method_declaration
modifiers
public "public"
integral_type
int "int"
identifier "getMaximum"
formal_parameters
( "("
) ")"
block
{ "{"
return_statement
return "return"
identifier "maximum"
; ";"
} "}"
method_declaration (+22 nodes collapsed)
method_declaration (+144 nodes collapsed)
} "}"
class_declaration (+117 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 "cli2"
. "."
identifier "option"
; ";"
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 "Collection"
; ";"
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 "Comparator"
; ";"
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 "Iterator"
; ";"
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 "ListIterator"
; ";"
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"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "SortedMap"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "TreeMap"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "apache"
. "."
identifier "commons"
. "."
identifier "cli2"
. "."
identifier "Argument"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "apache"
. "."
identifier "commons"
. "."
identifier "cli2"
. "."
identifier "DisplaySetting"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "apache"
. "."
identifier "commons"
. "."
identifier "cli2"
. "."
identifier "Group"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "apache"
. "."
identifier "commons"
. "."
identifier "cli2"
. "."
identifier "HelpLine"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "apache"
. "."
identifier "commons"
. "."
identifier "cli2"
. "."
identifier "Option"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "apache"
. "."
identifier "commons"
. "."
identifier "cli2"
. "."
identifier "OptionException"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "apache"
. "."
identifier "commons"
. "."
identifier "cli2"
. "."
identifier "WriteableCommandLine"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "apache"
. "."
identifier "commons"
. "."
identifier "cli2"
. "."
identifier "resource"
. "."
identifier "ResourceConstants"
; ";"
block_comment "/**\n * An implementation of Group\n */"
class_declaration
modifiers
public "public"
class "class"
identifier "GroupImpl"
superclass
extends "extends"
type_identifier "OptionImpl"
super_interfaces
implements "implements"
type_list
type_identifier "Group"
class_body
{ "{"
field_declaration
modifiers
private "private"
final "final"
type_identifier "String"
variable_declarator
identifier "name"
; ";"
field_declaration
modifiers
private "private"
final "final"
type_identifier "String"
variable_declarator
identifier "description"
; ";"
field_declaration
modifiers
private "private"
final "final"
type_identifier "List"
variable_declarator
identifier "options"
; ";"
field_declaration
modifiers
private "private"
final "final"
integral_type
int "int"
variable_declarator
identifier "minimum"
; ";"
field_declaration
modifiers
private "private"
final "final"
integral_type
int "int"
variable_declarator
identifier "maximum"
; ";"
field_declaration
modifiers
private "private"
final "final"
type_identifier "List"
variable_declarator
identifier "anonymous"
; ";"
field_declaration
modifiers
private "private"
final "final"
type_identifier "SortedMap"
variable_declarator
identifier "optionMap"
; ";"
field_declaration
modifiers
private "private"
final "final"
type_identifier "Set"
variable_declarator
identifier "prefixes"
; ";"
block_comment "/**\n * Creates a new GroupImpl using the specified param"...
constructor_declaration (+367 nodes collapsed)
method_declaration (+201 nodes collapsed)
method_declaration
modifiers
public "public"
type_identifier "Set"
identifier "getPrefixes"
formal_parameters
( "("
) ")"
block
{ "{"
return_statement
return "return"
identifier "prefixes"
; ";"
} "}"
method_declaration (+21 nodes collapsed)
method_declaration (+449 nodes collapsed)
method_declaration
modifiers
public "public"
void_type "void"
identifier "validate"
formal_parameters
( "("
formal_parameter
modifiers
final "final"
type_identifier "WriteableCommandLine"
identifier "commandLine"
) ")"
throws
throws "throws"
type_identifier "OptionException"
block
{ "{"
line_comment "// number of options found"
local_variable_declaration
integral_type
int "int"
variable_declarator
identifier "present"
= "="
decimal_integer_literal "0"
; ";"
line_comment "// reference to first unexpected option"
local_variable_declaration
type_identifier "Option"
variable_declarator
identifier "unexpected"
= "="
null_literal "null"
; ";"
for_statement
for "for"
( "("
local_variable_declaration
modifiers
final "final"
type_identifier "Iterator"
variable_declarator
identifier "i"
= "="
method_invocation
identifier "options"
. "."
identifier "iterator"
argument_list
( "("
) ")"
; ";"
method_invocation
identifier "i"
. "."
identifier "hasNext"
argument_list
( "("
) ")"
; ";"
) ")"
block
{ "{"
local_variable_declaration
modifiers
final "final"
type_identifier "Option"
variable_declarator
identifier "option"
= "="
cast_expression
( "("
type_identifier "Option"
) ")"
method_invocation
identifier "i"
. "."
identifier "next"
argument_list
( "("
) ")"
; ";"
line_comment "// needs validation?"
local_variable_declaration
boolean_type "boolean"
variable_declarator
identifier "validate"
= "="
binary_expression
method_invocation
identifier "option"
. "."
identifier "isRequired"
argument_list
( "("
) ")"
|| "||"
instanceof_expression
identifier "option"
instanceof "instanceof"
type_identifier "Group"
; ";"
line_comment "// if the child option is present then validate it"
if_statement
if "if"
parenthesized_expression
( "("
method_invocation
identifier "commandLine"
. "."
identifier "hasOption"
argument_list
( "("
identifier "option"
) ")"
) ")"
block
{ "{"
if_statement (+23 nodes collapsed)
expression_statement
assignment_expression
identifier "validate"
= "="
true "true"
; ";"
} "}"
if_statement
if "if"
parenthesized_expression
( "("
identifier "validate"
) ")"
block
{ "{"
expression_statement
method_invocation
identifier "option"
. "."
identifier "validate"
argument_list
( "("
identifier "commandLine"
) ")"
; ";"
} "}"
} "}"
line_comment "// too many options"
if_statement (+35 nodes collapsed)
line_comment "// too few option"
if_statement (+27 nodes collapsed)
line_comment "// validate each anonymous argument"
for_statement (+59 nodes collapsed)
} "}"
method_declaration
modifiers
public "public"
type_identifier "String"
identifier "getPreferredName"
formal_parameters
( "("
) ")"
block
{ "{"
return_statement
return "return"
identifier "name"
; ";"
} "}"
method_declaration
modifiers
public "public"
type_identifier "String"
identifier "getDescription"
formal_parameters
( "("
) ")"
block
{ "{"
return_statement
return "return"
identifier "description"
; ";"
} "}"
method_declaration (+45 nodes collapsed)
method_declaration (+633 nodes collapsed)
method_declaration (+334 nodes collapsed)
block_comment "/**\n * Gets the member Options of thie Group.\n * Not"...
method_declaration
modifiers
public "public"
type_identifier "List"
identifier "getOptions"
formal_parameters
( "("
) ")"
block
{ "{"
return_statement
return "return"
identifier "options"
; ";"
} "}"
block_comment "/**\n * Gets the anonymous Arguments of this Group.\n "...
method_declaration
modifiers
public "public"
type_identifier "List"
identifier "getAnonymous"
formal_parameters
( "("
) ")"
block
{ "{"
return_statement
return "return"
identifier "anonymous"
; ";"
} "}"
method_declaration (+105 nodes collapsed)
method_declaration
modifiers
public "public"
integral_type
int "int"
identifier "getMinimum"
formal_parameters
( "("
) ")"
block
{ "{"
return_statement
return "return"
identifier "minimum"
; ";"
} "}"
method_declaration
modifiers
public "public"
integral_type
int "int"
identifier "getMaximum"
formal_parameters
( "("
) ")"
block
{ "{"
return_statement
return "return"
identifier "maximum"
; ";"
} "}"
method_declaration (+22 nodes collapsed)
method_declaration (+144 nodes collapsed)
} "}"
class_declaration (+117 nodes collapsed)