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–142 unchanged (142 lines)
143 return;
144 }
145
146 for (Enumeration e = properties.propertyNames(); e.hasMoreElements();)
147 {
148 String option = e.nextElement().toString();
149
150 if (!cmd.hasOption(option))
151 {
152 Option opt = options.getOption(option);
153
154 // if the option is part of a group, check if another option of the group has been selected
155
156 // get the value from the properties
157 String value = properties.getProperty(option);
158
159 if (opt.hasArg())
160 {
161 if (opt.getValues() == null || opt.getValues().length == 0)
…lines 162–684 unchanged (523 lines)

After

…lines 1–143 unchanged (143 lines)
144 }
145
146 for (Enumeration e = properties.propertyNames(); e.hasMoreElements();)
147 {
148 String option = e.nextElement().toString();
149
150 Option opt = options.getOption(option);
151 if (opt == null)
152 {
153 throw new UnrecognizedOptionException("Default option wasn't defined", option);
154 }
155
156 // if the option is part of a group, check if another option of the group has been selected
157 OptionGroup group = options.getOptionGroup(opt);
158 boolean selected = group != null && group.getSelected() != null;
159
160 if (!cmd.hasOption(option) && !selected)
161 {
162 // get the value from the properties
163 String value = properties.getProperty(option);
164
165 if (opt.hasArg())
166 {
…lines 167–690 unchanged (524 lines)

Before

program
block_comment "/**\n * Licensed to the Apache Software Foundation (ASF) unde"...
package_declaration
package "package"
scoped_identifier
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "apache"
. "."
identifier "commons"
. "."
identifier "cli"
; ";"
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 "Enumeration"
; ";"
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 "Properties"
; ";"
block_comment "/**\n * Default parser.\n * \n * @author Emmanuel Bourg\n * @ver"...
class_declaration
modifiers
public "public"
class "class"
identifier "DefaultParser"
super_interfaces
implements "implements"
type_list
type_identifier "CommandLineParser"
class_body
{ "{"
field_declaration
modifiers
protected "protected"
type_identifier "CommandLine"
variable_declarator
identifier "cmd"
; ";"
field_declaration
modifiers
protected "protected"
type_identifier "Options"
variable_declarator
identifier "options"
; ";"
block_comment "/** \n * Flag indicating how unrecognized tokens are hand"...
field_declaration
modifiers
protected "protected"
boolean_type "boolean"
variable_declarator
identifier "stopAtNonOption"
; ";"
block_comment "/** The token currently processed. */"
field_declaration
modifiers
protected "protected"
type_identifier "String"
variable_declarator
identifier "currentToken"
; ";"
block_comment "/** The last option parsed. */"
field_declaration
modifiers
protected "protected"
type_identifier "Option"
variable_declarator
identifier "currentOption"
; ";"
block_comment "/** Flag indicating if tokens should no longer be analysed a"...
field_declaration
modifiers
protected "protected"
boolean_type "boolean"
variable_declarator
identifier "skipParsing"
; ";"
block_comment "/** The required options expected to be found when parsing t"...
field_declaration
modifiers
protected "protected"
type_identifier "List"
variable_declarator
identifier "expectedOpts"
; ";"
method_declaration (+38 nodes collapsed)
block_comment "/**\n * Parse the arguments according to the specified op"...
method_declaration (+44 nodes collapsed)
method_declaration (+44 nodes collapsed)
block_comment "/**\n * Parse the arguments according to the specified op"...
method_declaration (+232 nodes collapsed)
block_comment "/**\n * Sets the values of Options using the values in <c"...
method_declaration
modifiers
private "private"
void_type "void"
identifier "handleProperties"
formal_parameters
( "("
formal_parameter
type_identifier "Properties"
identifier "properties"
) ")"
throws
throws "throws"
type_identifier "ParseException"
block
{ "{"
if_statement
if "if"
parenthesized_expression
( "("
binary_expression
identifier "properties"
== "=="
null_literal "null"
) ")"
block
{ "{"
return_statement
return "return"
; ";"
} "}"
for_statement
for "for"
( "("
local_variable_declaration
type_identifier "Enumeration"
variable_declarator
identifier "e"
= "="
method_invocation
identifier "properties"
. "."
identifier "propertyNames"
argument_list
( "("
) ")"
; ";"
method_invocation
identifier "e"
. "."
identifier "hasMoreElements"
argument_list
( "("
) ")"
; ";"
) ")"
block
{ "{"
local_variable_declaration
type_identifier "String"
variable_declarator
identifier "option"
= "="
method_invocation
method_invocation
identifier "e"
. "."
identifier "nextElement"
argument_list
( "("
) ")"
. "."
identifier "toString"
argument_list
( "("
) ")"
; ";"
if_statement
if "if"
parenthesized_expression
( "("
unary_expression
! "!"
method_invocation
identifier "cmd"
. "."
identifier "hasOption"
argument_list
( "("
identifier "option"
) ")"
) ")"
block
{ "{"
local_variable_declaration
type_identifier "Option"
variable_declarator
identifier "opt"
= "="
method_invocation
identifier "options"
. "."
identifier "getOption"
argument_list
( "("
identifier "option"
) ")"
; ";"
line_comment "// if the option is part of a group, check if another option"...
line_comment "// get the value from the properties"
local_variable_declaration
type_identifier "String"
variable_declarator
identifier "value"
= "="
method_invocation
identifier "properties"
. "."
identifier "getProperty"
argument_list
( "("
identifier "option"
) ")"
; ";"
if_statement (+113 nodes collapsed)
expression_statement
method_invocation
identifier "handleOption"
argument_list
( "("
identifier "opt"
) ")"
; ";"
expression_statement
assignment_expression
identifier "currentOption"
= "="
null_literal "null"
; ";"
} "}"
} "}"
} "}"
block_comment "/**\n * Throws a {@link MissingOptionException} if all of"...
method_declaration (+42 nodes collapsed)
block_comment "/**\n * Throw a {@link MissingArgumentException} if the c"...
method_declaration (+45 nodes collapsed)
block_comment "/**\n * Handle any command line token.\n * \n * @pa"...
method_declaration (+227 nodes collapsed)
block_comment "/**\n * Returns true is the token is a valid argument.\n "...
method_declaration (+33 nodes collapsed)
block_comment "/**\n * Check if the token is a negative number.\n * \n"...
method_declaration (+48 nodes collapsed)
block_comment "/**\n * Tells if the token looks like an option.\n * \n"...
method_declaration (+31 nodes collapsed)
block_comment "/**\n * Tells if the token looks like a short option.\n "...
method_declaration (+60 nodes collapsed)
block_comment "/**\n * Tells if the token looks like a long option.\n "...
method_declaration (+166 nodes collapsed)
block_comment "/**\n * Handles an unknown token. If the token starts wit"...
method_declaration (+96 nodes collapsed)
block_comment "/**\n * Handles the following tokens:\n * \n * --L\n"...
method_declaration (+58 nodes collapsed)
block_comment "/**\n * Handles the following tokens:\n * \n * --L\n"...
method_declaration (+115 nodes collapsed)
block_comment "/**\n * Handles the following tokens:\n * \n * --L="...
method_declaration (+213 nodes collapsed)
block_comment "/**\n * Handles the following tokens:\n * \n * -S\n "...
method_declaration (+566 nodes collapsed)
block_comment "/**\n * Search for a prefix that is the long name of an o"...
method_declaration (+115 nodes collapsed)
block_comment "/**\n * Check if the specified token is a Java-like prope"...
method_declaration (+81 nodes collapsed)
method_declaration (+90 nodes collapsed)
block_comment "/**\n * Removes the option or its group from the list of "...
method_declaration (+117 nodes collapsed)
block_comment "/**\n * Breaks <code>token</code> into its constituent pa"...
method_declaration (+188 nodes collapsed)
} "}"

After

program
block_comment "/**\n * Licensed to the Apache Software Foundation (ASF) unde"...
package_declaration
package "package"
scoped_identifier
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "apache"
. "."
identifier "commons"
. "."
identifier "cli"
; ";"
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 "Enumeration"
; ";"
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 "Properties"
; ";"
block_comment "/**\n * Default parser.\n * \n * @author Emmanuel Bourg\n * @ver"...
class_declaration
modifiers
public "public"
class "class"
identifier "DefaultParser"
super_interfaces
implements "implements"
type_list
type_identifier "CommandLineParser"
class_body
{ "{"
field_declaration
modifiers
protected "protected"
type_identifier "CommandLine"
variable_declarator
identifier "cmd"
; ";"
field_declaration
modifiers
protected "protected"
type_identifier "Options"
variable_declarator
identifier "options"
; ";"
block_comment "/** \n * Flag indicating how unrecognized tokens are hand"...
field_declaration
modifiers
protected "protected"
boolean_type "boolean"
variable_declarator
identifier "stopAtNonOption"
; ";"
block_comment "/** The token currently processed. */"
field_declaration
modifiers
protected "protected"
type_identifier "String"
variable_declarator
identifier "currentToken"
; ";"
block_comment "/** The last option parsed. */"
field_declaration
modifiers
protected "protected"
type_identifier "Option"
variable_declarator
identifier "currentOption"
; ";"
block_comment "/** Flag indicating if tokens should no longer be analysed a"...
field_declaration
modifiers
protected "protected"
boolean_type "boolean"
variable_declarator
identifier "skipParsing"
; ";"
block_comment "/** The required options expected to be found when parsing t"...
field_declaration
modifiers
protected "protected"
type_identifier "List"
variable_declarator
identifier "expectedOpts"
; ";"
method_declaration (+38 nodes collapsed)
block_comment "/**\n * Parse the arguments according to the specified op"...
method_declaration (+44 nodes collapsed)
method_declaration (+44 nodes collapsed)
block_comment "/**\n * Parse the arguments according to the specified op"...
method_declaration (+232 nodes collapsed)
block_comment "/**\n * Sets the values of Options using the values in <c"...
method_declaration
modifiers
private "private"
void_type "void"
identifier "handleProperties"
formal_parameters
( "("
formal_parameter
type_identifier "Properties"
identifier "properties"
) ")"
throws
throws "throws"
type_identifier "ParseException"
block
{ "{"
if_statement
if "if"
parenthesized_expression
( "("
binary_expression
identifier "properties"
== "=="
null_literal "null"
) ")"
block
{ "{"
return_statement
return "return"
; ";"
} "}"
for_statement
for "for"
( "("
local_variable_declaration
type_identifier "Enumeration"
variable_declarator
identifier "e"
= "="
method_invocation
identifier "properties"
. "."
identifier "propertyNames"
argument_list
( "("
) ")"
; ";"
method_invocation
identifier "e"
. "."
identifier "hasMoreElements"
argument_list
( "("
) ")"
; ";"
) ")"
block
{ "{"
local_variable_declaration
type_identifier "String"
variable_declarator
identifier "option"
= "="
method_invocation
method_invocation
identifier "e"
. "."
identifier "nextElement"
argument_list
( "("
) ")"
. "."
identifier "toString"
argument_list
( "("
) ")"
; ";"
local_variable_declaration
type_identifier "Option"
variable_declarator
identifier "opt"
= "="
method_invocation
identifier "options"
. "."
identifier "getOption"
argument_list
( "("
identifier "option"
) ")"
; ";"
if_statement
if "if"
parenthesized_expression
( "("
binary_expression
identifier "opt"
== "=="
null_literal "null"
) ")"
block
{ "{"
throw_statement
throw "throw"
object_creation_expression
new "new"
type_identifier "UnrecognizedOptionException"
argument_list
( "("
string_literal
" "\""
string_fragment "Default option wasn't defined"
" "\""
, ","
identifier "option"
) ")"
; ";"
} "}"
line_comment "// if the option is part of a group, check if another option"...
local_variable_declaration
type_identifier "OptionGroup"
variable_declarator
identifier "group"
= "="
method_invocation
identifier "options"
. "."
identifier "getOptionGroup"
argument_list
( "("
identifier "opt"
) ")"
; ";"
local_variable_declaration
boolean_type "boolean"
variable_declarator
identifier "selected"
= "="
binary_expression
binary_expression
identifier "group"
!= "!="
null_literal "null"
&& "&&"
binary_expression
method_invocation
identifier "group"
. "."
identifier "getSelected"
argument_list
( "("
) ")"
!= "!="
null_literal "null"
; ";"
if_statement
if "if"
parenthesized_expression
( "("
binary_expression
unary_expression
! "!"
method_invocation
identifier "cmd"
. "."
identifier "hasOption"
argument_list
( "("
identifier "option"
) ")"
&& "&&"
unary_expression
! "!"
identifier "selected"
) ")"
block
{ "{"
line_comment "// get the value from the properties"
local_variable_declaration
type_identifier "String"
variable_declarator
identifier "value"
= "="
method_invocation
identifier "properties"
. "."
identifier "getProperty"
argument_list
( "("
identifier "option"
) ")"
; ";"
if_statement (+113 nodes collapsed)
expression_statement
method_invocation
identifier "handleOption"
argument_list
( "("
identifier "opt"
) ")"
; ";"
expression_statement
assignment_expression
identifier "currentOption"
= "="
null_literal "null"
; ";"
} "}"
} "}"
} "}"
block_comment "/**\n * Throws a {@link MissingOptionException} if all of"...
method_declaration (+42 nodes collapsed)
block_comment "/**\n * Throw a {@link MissingArgumentException} if the c"...
method_declaration (+45 nodes collapsed)
block_comment "/**\n * Handle any command line token.\n * \n * @pa"...
method_declaration (+227 nodes collapsed)
block_comment "/**\n * Returns true is the token is a valid argument.\n "...
method_declaration (+33 nodes collapsed)
block_comment "/**\n * Check if the token is a negative number.\n * \n"...
method_declaration (+48 nodes collapsed)
block_comment "/**\n * Tells if the token looks like an option.\n * \n"...
method_declaration (+31 nodes collapsed)
block_comment "/**\n * Tells if the token looks like a short option.\n "...
method_declaration (+60 nodes collapsed)
block_comment "/**\n * Tells if the token looks like a long option.\n "...
method_declaration (+166 nodes collapsed)
block_comment "/**\n * Handles an unknown token. If the token starts wit"...
method_declaration (+96 nodes collapsed)
block_comment "/**\n * Handles the following tokens:\n * \n * --L\n"...
method_declaration (+58 nodes collapsed)
block_comment "/**\n * Handles the following tokens:\n * \n * --L\n"...
method_declaration (+115 nodes collapsed)
block_comment "/**\n * Handles the following tokens:\n * \n * --L="...
method_declaration (+213 nodes collapsed)
block_comment "/**\n * Handles the following tokens:\n * \n * -S\n "...
method_declaration (+566 nodes collapsed)
block_comment "/**\n * Search for a prefix that is the long name of an o"...
method_declaration (+115 nodes collapsed)
block_comment "/**\n * Check if the specified token is a Java-like prope"...
method_declaration (+81 nodes collapsed)
method_declaration (+90 nodes collapsed)
block_comment "/**\n * Removes the option or its group from the list of "...
method_declaration (+117 nodes collapsed)
block_comment "/**\n * Breaks <code>token</code> into its constituent pa"...
method_declaration (+188 nodes collapsed)
} "}"