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–13 unchanged (13 lines)
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17package org.apache.commons.jxpath.ri.axes;
18
19import java.util.ArrayList;
20
21import org.apache.commons.jxpath.BasicNodeSet;
22import org.apache.commons.jxpath.ri.EvalContext;
23import org.apache.commons.jxpath.ri.model.NodePointer;
24
25/**
26 * EvalContext that represents a union between other contexts - result
27 * of a union operation like (a | b)
28 *
…lines 29–49 unchanged (21 lines)
50 for (int i = 0; i < contexts.length; i++) {
51 EvalContext ctx = (EvalContext) contexts[i];
52 while (ctx.nextSet()) {
53 while (ctx.nextNode()) {
54 NodePointer ptr = ctx.getCurrentNodePointer();
55 if (!pointers.contains(ptr)) {
56 nodeSet.add(ptr);
57 pointers.add(ptr);
58 }
59 }
60 }
61 }
62 }
63 return super.setPosition(position);
64 }
65}
66

After

…lines 1–13 unchanged (13 lines)
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17package org.apache.commons.jxpath.ri.axes;
18
19import java.util.ArrayList;
20import java.util.Iterator;
21
22import org.apache.commons.jxpath.BasicNodeSet;
23import org.apache.commons.jxpath.Pointer;
24import org.apache.commons.jxpath.ri.EvalContext;
25import org.apache.commons.jxpath.ri.model.NodePointer;
26
27/**
28 * EvalContext that represents a union between other contexts - result
29 * of a union operation like (a | b)
…lines 30–51 unchanged (22 lines)
52 for (int i = 0; i < contexts.length; i++) {
53 EvalContext ctx = (EvalContext) contexts[i];
54 while (ctx.nextSet()) {
55 while (ctx.nextNode()) {
56 NodePointer ptr = ctx.getCurrentNodePointer();
57 if (!pointers.contains(ptr)) {
58 pointers.add(ptr);
59 }
60 }
61 }
62 }
63 sortPointers(pointers);
64
65 for (Iterator it = pointers.iterator(); it.hasNext();) {
66 nodeSet.add((Pointer) it.next());
67 }
68 }
69 return super.setPosition(position);
70 }
71}

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
scoped_identifier
identifier "org"
. "."
identifier "apache"
. "."
identifier "commons"
. "."
identifier "jxpath"
. "."
identifier "ri"
. "."
identifier "axes"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "ArrayList"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "apache"
. "."
identifier "commons"
. "."
identifier "jxpath"
. "."
identifier "BasicNodeSet"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "apache"
. "."
identifier "commons"
. "."
identifier "jxpath"
. "."
identifier "ri"
. "."
identifier "EvalContext"
; ";"
import_declaration (+22 nodes collapsed)
block_comment "/**\n * EvalContext that represents a union between other con"...
class_declaration
modifiers
public "public"
class "class"
identifier "UnionContext"
superclass
extends "extends"
type_identifier "NodeSetContext"
class_body
{ "{"
field_declaration
modifiers
private "private"
type_identifier "EvalContext"
variable_declarator
identifier "contexts"
dimensions
[ "["
] "]"
; ";"
field_declaration
modifiers
private "private"
boolean_type "boolean"
variable_declarator
identifier "prepared"
; ";"
constructor_declaration (+43 nodes collapsed)
method_declaration (+33 nodes collapsed)
method_declaration
modifiers
public "public"
boolean_type "boolean"
identifier "setPosition"
formal_parameters
( "("
formal_parameter
integral_type
int "int"
identifier "position"
) ")"
block
{ "{"
if_statement
if "if"
parenthesized_expression
( "("
unary_expression
! "!"
identifier "prepared"
) ")"
block
{ "{"
expression_statement
assignment_expression
identifier "prepared"
= "="
true "true"
; ";"
local_variable_declaration
type_identifier "BasicNodeSet"
variable_declarator
identifier "nodeSet"
= "="
cast_expression
( "("
type_identifier "BasicNodeSet"
) ")"
method_invocation
identifier "getNodeSet"
argument_list
( "("
) ")"
; ";"
local_variable_declaration
type_identifier "ArrayList"
variable_declarator
identifier "pointers"
= "="
object_creation_expression
new "new"
type_identifier "ArrayList"
argument_list
( "("
) ")"
; ";"
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 "contexts"
. "."
identifier "length"
; ";"
update_expression
identifier "i"
++ "++"
) ")"
block
{ "{"
local_variable_declaration
type_identifier "EvalContext"
variable_declarator
identifier "ctx"
= "="
cast_expression
( "("
type_identifier "EvalContext"
) ")"
array_access
identifier "contexts"
[ "["
identifier "i"
] "]"
; ";"
while_statement
while "while"
parenthesized_expression
( "("
method_invocation
identifier "ctx"
. "."
identifier "nextSet"
argument_list
( "("
) ")"
) ")"
block
{ "{"
while_statement
while "while"
parenthesized_expression
( "("
method_invocation
identifier "ctx"
. "."
identifier "nextNode"
argument_list
( "("
) ")"
) ")"
block
{ "{"
local_variable_declaration
type_identifier "NodePointer"
variable_declarator
identifier "ptr"
= "="
method_invocation
identifier "ctx"
. "."
identifier "getCurrentNodePointer"
argument_list
( "("
) ")"
; ";"
if_statement
if "if"
parenthesized_expression
( "("
unary_expression
! "!"
method_invocation
identifier "pointers"
. "."
identifier "contains"
argument_list
( "("
identifier "ptr"
) ")"
) ")"
block
{ "{"
expression_statement
method_invocation
identifier "nodeSet"
. "."
identifier "add"
argument_list
( "("
identifier "ptr"
) ")"
; ";"
expression_statement
method_invocation
identifier "pointers"
. "."
identifier "add"
argument_list
( "("
identifier "ptr"
) ")"
; ";"
} "}"
} "}"
} "}"
} "}"
} "}"
return_statement
return "return"
method_invocation
super "super"
. "."
identifier "setPosition"
argument_list
( "("
identifier "position"
) ")"
; ";"
} "}"
} "}"

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
scoped_identifier
identifier "org"
. "."
identifier "apache"
. "."
identifier "commons"
. "."
identifier "jxpath"
. "."
identifier "ri"
. "."
identifier "axes"
; ";"
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 "Iterator"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "apache"
. "."
identifier "commons"
. "."
identifier "jxpath"
. "."
identifier "BasicNodeSet"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "apache"
. "."
identifier "commons"
. "."
identifier "jxpath"
. "."
identifier "Pointer"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "apache"
. "."
identifier "commons"
. "."
identifier "jxpath"
. "."
identifier "ri"
. "."
identifier "EvalContext"
; ";"
import_declaration (+22 nodes collapsed)
block_comment "/**\n * EvalContext that represents a union between other con"...
class_declaration
modifiers
public "public"
class "class"
identifier "UnionContext"
superclass
extends "extends"
type_identifier "NodeSetContext"
class_body
{ "{"
field_declaration
modifiers
private "private"
type_identifier "EvalContext"
variable_declarator
identifier "contexts"
dimensions
[ "["
] "]"
; ";"
field_declaration
modifiers
private "private"
boolean_type "boolean"
variable_declarator
identifier "prepared"
; ";"
constructor_declaration (+43 nodes collapsed)
method_declaration (+33 nodes collapsed)
method_declaration
modifiers
public "public"
boolean_type "boolean"
identifier "setPosition"
formal_parameters
( "("
formal_parameter
integral_type
int "int"
identifier "position"
) ")"
block
{ "{"
if_statement
if "if"
parenthesized_expression
( "("
unary_expression
! "!"
identifier "prepared"
) ")"
block
{ "{"
expression_statement
assignment_expression
identifier "prepared"
= "="
true "true"
; ";"
local_variable_declaration
type_identifier "BasicNodeSet"
variable_declarator
identifier "nodeSet"
= "="
cast_expression
( "("
type_identifier "BasicNodeSet"
) ")"
method_invocation
identifier "getNodeSet"
argument_list
( "("
) ")"
; ";"
local_variable_declaration
type_identifier "ArrayList"
variable_declarator
identifier "pointers"
= "="
object_creation_expression
new "new"
type_identifier "ArrayList"
argument_list
( "("
) ")"
; ";"
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 "contexts"
. "."
identifier "length"
; ";"
update_expression
identifier "i"
++ "++"
) ")"
block
{ "{"
local_variable_declaration
type_identifier "EvalContext"
variable_declarator
identifier "ctx"
= "="
cast_expression
( "("
type_identifier "EvalContext"
) ")"
array_access
identifier "contexts"
[ "["
identifier "i"
] "]"
; ";"
while_statement
while "while"
parenthesized_expression
( "("
method_invocation
identifier "ctx"
. "."
identifier "nextSet"
argument_list
( "("
) ")"
) ")"
block
{ "{"
while_statement
while "while"
parenthesized_expression
( "("
method_invocation
identifier "ctx"
. "."
identifier "nextNode"
argument_list
( "("
) ")"
) ")"
block
{ "{"
local_variable_declaration
type_identifier "NodePointer"
variable_declarator
identifier "ptr"
= "="
method_invocation
identifier "ctx"
. "."
identifier "getCurrentNodePointer"
argument_list
( "("
) ")"
; ";"
if_statement
if "if"
parenthesized_expression
( "("
unary_expression
! "!"
method_invocation
identifier "pointers"
. "."
identifier "contains"
argument_list
( "("
identifier "ptr"
) ")"
) ")"
block
{ "{"
expression_statement
method_invocation
identifier "pointers"
. "."
identifier "add"
argument_list
( "("
identifier "ptr"
) ")"
; ";"
} "}"
} "}"
} "}"
} "}"
expression_statement
method_invocation
identifier "sortPointers"
argument_list
( "("
identifier "pointers"
) ")"
; ";"
for_statement
for "for"
( "("
local_variable_declaration
type_identifier "Iterator"
variable_declarator
identifier "it"
= "="
method_invocation
identifier "pointers"
. "."
identifier "iterator"
argument_list
( "("
) ")"
; ";"
method_invocation
identifier "it"
. "."
identifier "hasNext"
argument_list
( "("
) ")"
; ";"
) ")"
block
{ "{"
expression_statement
method_invocation
identifier "nodeSet"
. "."
identifier "add"
argument_list
( "("
cast_expression
( "("
type_identifier "Pointer"
) ")"
method_invocation
identifier "it"
. "."
identifier "next"
argument_list
( "("
) ")"
) ")"
; ";"
} "}"
} "}"
return_statement
return "return"
method_invocation
super "super"
. "."
identifier "setPosition"
argument_list
( "("
identifier "position"
) ")"
; ";"
} "}"
} "}"