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–513 unchanged (513 lines)
514 dev = values[i] - mean;
515 accum += weights[i] * (dev * dev);
516 accum2 += weights[i] * dev;
517 }
518
519 double sumWts = 0;
520 for (int i = 0; i < weights.length; i++) {
521 sumWts += weights[i];
522 }
523
524 if (isBiasCorrected) {
525 var = (accum - (accum2 * accum2 / sumWts)) / (sumWts - 1.0);
526 } else {
…lines 527–621 unchanged (95 lines)

After

…lines 1–513 unchanged (513 lines)
514 dev = values[i] - mean;
515 accum += weights[i] * (dev * dev);
516 accum2 += weights[i] * dev;
517 }
518
519 double sumWts = 0;
520 for (int i = begin; i < begin + length; i++) {
521 sumWts += weights[i];
522 }
523
524 if (isBiasCorrected) {
525 var = (accum - (accum2 * accum2 / sumWts)) / (sumWts - 1.0);
526 } else {
…lines 527–621 unchanged (95 lines)

Before

program
block_comment "/*\n * Licensed to the Apache Software Foundation (ASF) under"...
package_declaration (+22 nodes collapsed)
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "io"
. "."
identifier "Serializable"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "apache"
. "."
identifier "commons"
. "."
identifier "math"
. "."
identifier "exception"
. "."
identifier "NullArgumentException"
; ";"
import_declaration (+22 nodes collapsed)
import_declaration (+22 nodes collapsed)
import_declaration (+22 nodes collapsed)
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "apache"
. "."
identifier "commons"
. "."
identifier "math"
. "."
identifier "util"
. "."
identifier "MathUtils"
; ";"
block_comment "/**\n * Computes the variance of the available values. By de"...
class_declaration
modifiers
public "public"
class "class"
identifier "Variance"
superclass
extends "extends"
type_identifier "AbstractStorelessUnivariateStatistic"
super_interfaces
implements "implements"
type_list
type_identifier "Serializable"
, ","
type_identifier "WeightedEvaluation"
class_body
{ "{"
block_comment "/** Serializable version identifier */"
field_declaration
modifiers
private "private"
static "static"
final "final"
integral_type
long "long"
variable_declarator
identifier "serialVersionUID"
= "="
unary_expression
- "-"
decimal_integer_literal "9111962718267217978L"
; ";"
block_comment "/** SecondMoment is used in incremental calculation of Varia"...
field_declaration
modifiers
protected "protected"
type_identifier "SecondMoment"
variable_declarator
identifier "moment"
= "="
null_literal "null"
; ";"
block_comment "/**\n * Whether or not {@link #increment(double)} should "...
field_declaration
modifiers
protected "protected"
boolean_type "boolean"
variable_declarator
identifier "incMoment"
= "="
true "true"
; ";"
block_comment "/**\n * Whether or not bias correction is applied when co"...
field_declaration
modifiers
private "private"
boolean_type "boolean"
variable_declarator
identifier "isBiasCorrected"
= "="
true "true"
; ";"
block_comment "/**\n * Constructs a Variance with default (true) <code>i"...
constructor_declaration (+21 nodes collapsed)
block_comment "/**\n * Constructs a Variance based on an external second"...
constructor_declaration (+30 nodes collapsed)
block_comment "/**\n * Constructs a Variance with the specified <code>is"...
constructor_declaration (+33 nodes collapsed)
block_comment "/**\n * Constructs a Variance with the specified <code>is"...
constructor_declaration (+41 nodes collapsed)
block_comment "/**\n * Copy constructor, creates a new {@code Variance} "...
constructor_declaration (+23 nodes collapsed)
block_comment "/**\n * {@inheritDoc}\n * <p>If all values are availab"...
method_declaration (+39 nodes collapsed)
block_comment "/**\n * {@inheritDoc}\n */"
method_declaration (+109 nodes collapsed)
block_comment "/**\n * {@inheritDoc}\n */"
method_declaration (+22 nodes collapsed)
block_comment "/**\n * {@inheritDoc}\n */"
method_declaration (+32 nodes collapsed)
block_comment "/**\n * Returns the variance of the entries in the input "...
method_declaration (+66 nodes collapsed)
block_comment "/**\n * Returns the variance of the entries in the specif"...
method_declaration (+158 nodes collapsed)
block_comment "/**\n * <p>Returns the weighted variance of the entries i"...
method_declaration (+172 nodes collapsed)
block_comment "/**\n * <p>\n * Returns the weighted variance of the e"...
method_declaration (+51 nodes collapsed)
block_comment "/**\n * Returns the variance of the entries in the specif"...
method_declaration (+260 nodes collapsed)
block_comment "/**\n * Returns the variance of the entries in the input "...
method_declaration (+47 nodes collapsed)
block_comment "/**\n * Returns the weighted variance of the entries in t"...
method_declaration
modifiers
public "public"
floating_point_type
double "double"
identifier "evaluate"
formal_parameters (+45 nodes collapsed)
block
{ "{"
local_variable_declaration
floating_point_type
double "double"
variable_declarator
identifier "var"
= "="
field_access
identifier "Double"
. "."
identifier "NaN"
; ";"
if_statement
if "if"
parenthesized_expression
( "("
method_invocation
identifier "test"
argument_list
( "("
identifier "values"
, ","
identifier "weights"
, ","
identifier "begin"
, ","
identifier "length"
) ")"
) ")"
block
{ "{"
if_statement
if "if"
parenthesized_expression
( "("
binary_expression
identifier "length"
== "=="
decimal_integer_literal "1"
) ")"
block
{ "{"
expression_statement
assignment_expression
identifier "var"
= "="
decimal_floating_point_literal "0.0"
; ";"
} "}"
else "else"
if_statement
if "if"
parenthesized_expression
( "("
binary_expression
identifier "length"
> ">"
decimal_integer_literal "1"
) ")"
block
{ "{"
local_variable_declaration
floating_point_type
double "double"
variable_declarator
identifier "accum"
= "="
decimal_floating_point_literal "0.0"
; ";"
local_variable_declaration
floating_point_type
double "double"
variable_declarator
identifier "dev"
= "="
decimal_floating_point_literal "0.0"
; ";"
local_variable_declaration
floating_point_type
double "double"
variable_declarator
identifier "accum2"
= "="
decimal_floating_point_literal "0.0"
; ";"
for_statement (+71 nodes collapsed)
local_variable_declaration
floating_point_type
double "double"
variable_declarator
identifier "sumWts"
= "="
decimal_integer_literal "0"
; ";"
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 "weights"
. "."
identifier "length"
; ";"
update_expression
identifier "i"
++ "++"
) ")"
block
{ "{"
expression_statement
assignment_expression
identifier "sumWts"
+= "+="
array_access
identifier "weights"
[ "["
identifier "i"
] "]"
; ";"
} "}"
if_statement (+67 nodes collapsed)
} "}"
} "}"
return_statement
return "return"
identifier "var"
; ";"
} "}"
block_comment "/**\n * <p>Returns the weighted variance of the values in"...
method_declaration (+60 nodes collapsed)
block_comment "/**\n * @return Returns the isBiasCorrected.\n */"
method_declaration
modifiers
public "public"
boolean_type "boolean"
identifier "isBiasCorrected"
formal_parameters
( "("
) ")"
block
{ "{"
return_statement
return "return"
identifier "isBiasCorrected"
; ";"
} "}"
block_comment "/**\n * @param biasCorrected The isBiasCorrected to set.\n"...
method_declaration (+23 nodes collapsed)
block_comment "/**\n * {@inheritDoc}\n */"
method_declaration (+40 nodes collapsed)
block_comment "/**\n * Copies source to dest.\n * <p>Neither source n"...
method_declaration (+100 nodes collapsed)
} "}"

After

program
block_comment "/*\n * Licensed to the Apache Software Foundation (ASF) under"...
package_declaration (+22 nodes collapsed)
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "io"
. "."
identifier "Serializable"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "apache"
. "."
identifier "commons"
. "."
identifier "math"
. "."
identifier "exception"
. "."
identifier "NullArgumentException"
; ";"
import_declaration (+22 nodes collapsed)
import_declaration (+22 nodes collapsed)
import_declaration (+22 nodes collapsed)
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "apache"
. "."
identifier "commons"
. "."
identifier "math"
. "."
identifier "util"
. "."
identifier "MathUtils"
; ";"
block_comment "/**\n * Computes the variance of the available values. By de"...
class_declaration
modifiers
public "public"
class "class"
identifier "Variance"
superclass
extends "extends"
type_identifier "AbstractStorelessUnivariateStatistic"
super_interfaces
implements "implements"
type_list
type_identifier "Serializable"
, ","
type_identifier "WeightedEvaluation"
class_body
{ "{"
block_comment "/** Serializable version identifier */"
field_declaration
modifiers
private "private"
static "static"
final "final"
integral_type
long "long"
variable_declarator
identifier "serialVersionUID"
= "="
unary_expression
- "-"
decimal_integer_literal "9111962718267217978L"
; ";"
block_comment "/** SecondMoment is used in incremental calculation of Varia"...
field_declaration
modifiers
protected "protected"
type_identifier "SecondMoment"
variable_declarator
identifier "moment"
= "="
null_literal "null"
; ";"
block_comment "/**\n * Whether or not {@link #increment(double)} should "...
field_declaration
modifiers
protected "protected"
boolean_type "boolean"
variable_declarator
identifier "incMoment"
= "="
true "true"
; ";"
block_comment "/**\n * Whether or not bias correction is applied when co"...
field_declaration
modifiers
private "private"
boolean_type "boolean"
variable_declarator
identifier "isBiasCorrected"
= "="
true "true"
; ";"
block_comment "/**\n * Constructs a Variance with default (true) <code>i"...
constructor_declaration (+21 nodes collapsed)
block_comment "/**\n * Constructs a Variance based on an external second"...
constructor_declaration (+30 nodes collapsed)
block_comment "/**\n * Constructs a Variance with the specified <code>is"...
constructor_declaration (+33 nodes collapsed)
block_comment "/**\n * Constructs a Variance with the specified <code>is"...
constructor_declaration (+41 nodes collapsed)
block_comment "/**\n * Copy constructor, creates a new {@code Variance} "...
constructor_declaration (+23 nodes collapsed)
block_comment "/**\n * {@inheritDoc}\n * <p>If all values are availab"...
method_declaration (+39 nodes collapsed)
block_comment "/**\n * {@inheritDoc}\n */"
method_declaration (+109 nodes collapsed)
block_comment "/**\n * {@inheritDoc}\n */"
method_declaration (+22 nodes collapsed)
block_comment "/**\n * {@inheritDoc}\n */"
method_declaration (+32 nodes collapsed)
block_comment "/**\n * Returns the variance of the entries in the input "...
method_declaration (+66 nodes collapsed)
block_comment "/**\n * Returns the variance of the entries in the specif"...
method_declaration (+158 nodes collapsed)
block_comment "/**\n * <p>Returns the weighted variance of the entries i"...
method_declaration (+172 nodes collapsed)
block_comment "/**\n * <p>\n * Returns the weighted variance of the e"...
method_declaration (+51 nodes collapsed)
block_comment "/**\n * Returns the variance of the entries in the specif"...
method_declaration (+260 nodes collapsed)
block_comment "/**\n * Returns the variance of the entries in the input "...
method_declaration (+47 nodes collapsed)
block_comment "/**\n * Returns the weighted variance of the entries in t"...
method_declaration
modifiers
public "public"
floating_point_type
double "double"
identifier "evaluate"
formal_parameters (+45 nodes collapsed)
block
{ "{"
local_variable_declaration
floating_point_type
double "double"
variable_declarator
identifier "var"
= "="
field_access
identifier "Double"
. "."
identifier "NaN"
; ";"
if_statement
if "if"
parenthesized_expression
( "("
method_invocation
identifier "test"
argument_list
( "("
identifier "values"
, ","
identifier "weights"
, ","
identifier "begin"
, ","
identifier "length"
) ")"
) ")"
block
{ "{"
if_statement
if "if"
parenthesized_expression
( "("
binary_expression
identifier "length"
== "=="
decimal_integer_literal "1"
) ")"
block
{ "{"
expression_statement
assignment_expression
identifier "var"
= "="
decimal_floating_point_literal "0.0"
; ";"
} "}"
else "else"
if_statement
if "if"
parenthesized_expression
( "("
binary_expression
identifier "length"
> ">"
decimal_integer_literal "1"
) ")"
block
{ "{"
local_variable_declaration
floating_point_type
double "double"
variable_declarator
identifier "accum"
= "="
decimal_floating_point_literal "0.0"
; ";"
local_variable_declaration
floating_point_type
double "double"
variable_declarator
identifier "dev"
= "="
decimal_floating_point_literal "0.0"
; ";"
local_variable_declaration
floating_point_type
double "double"
variable_declarator
identifier "accum2"
= "="
decimal_floating_point_literal "0.0"
; ";"
for_statement (+71 nodes collapsed)
local_variable_declaration
floating_point_type
double "double"
variable_declarator
identifier "sumWts"
= "="
decimal_integer_literal "0"
; ";"
for_statement
for "for"
( "("
local_variable_declaration
integral_type
int "int"
variable_declarator
identifier "i"
= "="
identifier "begin"
; ";"
binary_expression
identifier "i"
< "<"
binary_expression
identifier "begin"
+ "+"
identifier "length"
; ";"
update_expression
identifier "i"
++ "++"
) ")"
block
{ "{"
expression_statement
assignment_expression
identifier "sumWts"
+= "+="
array_access
identifier "weights"
[ "["
identifier "i"
] "]"
; ";"
} "}"
if_statement (+67 nodes collapsed)
} "}"
} "}"
return_statement
return "return"
identifier "var"
; ";"
} "}"
block_comment "/**\n * <p>Returns the weighted variance of the values in"...
method_declaration (+60 nodes collapsed)
block_comment "/**\n * @return Returns the isBiasCorrected.\n */"
method_declaration
modifiers
public "public"
boolean_type "boolean"
identifier "isBiasCorrected"
formal_parameters
( "("
) ")"
block
{ "{"
return_statement
return "return"
identifier "isBiasCorrected"
; ";"
} "}"
block_comment "/**\n * @param biasCorrected The isBiasCorrected to set.\n"...
method_declaration (+23 nodes collapsed)
block_comment "/**\n * {@inheritDoc}\n */"
method_declaration (+40 nodes collapsed)
block_comment "/**\n * Copies source to dest.\n * <p>Neither source n"...
method_declaration (+100 nodes collapsed)
} "}"