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–536 unchanged (536 lines)
537 * @return A copy of the overwritten data item, or <code>null</code> if no
538 * item was overwritten.
539 */
540 public XYDataItem addOrUpdate(Number x, Number y) {
541 if (x == null) {
542 throw new IllegalArgumentException("Null 'x' argument.");
543 }
544
545 // if we get to here, we know that duplicate X values are not permitted
546 XYDataItem overwritten = null;
547 int index = indexOf(x);
548 if (index >= 0 && !this.allowDuplicateXValues) {
549 XYDataItem existing = (XYDataItem) this.data.get(index);
550 try {
551 overwritten = (XYDataItem) existing.clone();
552 }
553 catch (CloneNotSupportedException e) {
554 throw new SeriesException("Couldn't clone XYDataItem!");
555 }
556 existing.setY(y);
557 }
558 else {
559 // if the series is sorted, the negative index is a result from
560 // Collections.binarySearch() and tells us where to insert the
561 // new item...otherwise it will be just -1 and we should just
562 // append the value to the list...
563 if (this.autoSort) {
…lines 564–734 unchanged (171 lines)

After

…lines 1–537 unchanged (537 lines)
538 * item was overwritten.
539 */
540 public XYDataItem addOrUpdate(Number x, Number y) {
541 if (x == null) {
542 throw new IllegalArgumentException("Null 'x' argument.");
543 }
544 if (this.allowDuplicateXValues) {
545 add(x, y);
546 return null;
547 }
548
549 // if we get to here, we know that duplicate X values are not permitted
550 XYDataItem overwritten = null;
551 int index = indexOf(x);
552 if (index >= 0) {
553 XYDataItem existing = (XYDataItem) this.data.get(index);
554 try {
555 overwritten = (XYDataItem) existing.clone();
556 }
557 catch (CloneNotSupportedException e) {
558 throw new SeriesException("Couldn't clone XYDataItem!");
559 }
560 existing.setY(y);
561 }
562 else {
563 // if the series is sorted, the negative index is a result from
564 // Collections.binarySearch() and tells us where to insert the
565 // new item...otherwise it will be just -1 and we should just
566 // append the value to the list...
567 if (this.autoSort) {
…lines 568–738 unchanged (171 lines)

Before

program
block_comment "/* ========================================================="...
package_declaration
package "package"
scoped_identifier
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "jfree"
. "."
identifier "data"
. "."
identifier "xy"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "io"
. "."
identifier "Serializable"
; ";"
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 "List"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "jfree"
. "."
identifier "chart"
. "."
identifier "util"
. "."
identifier "ObjectUtilities"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "jfree"
. "."
identifier "data"
. "."
identifier "general"
. "."
identifier "Series"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "jfree"
. "."
identifier "data"
. "."
identifier "general"
. "."
identifier "SeriesChangeEvent"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "jfree"
. "."
identifier "data"
. "."
identifier "general"
. "."
identifier "SeriesException"
; ";"
block_comment "/**\r\n * Represents a sequence of zero or more data items in "...
class_declaration
modifiers
public "public"
class "class"
identifier "XYSeries"
superclass
extends "extends"
type_identifier "Series"
super_interfaces
implements "implements"
type_list
type_identifier "Cloneable"
, ","
type_identifier "Serializable"
class_body
{ "{"
block_comment "/** For serialization. */"
field_declaration
modifiers
static "static"
final "final"
integral_type
long "long"
variable_declarator
identifier "serialVersionUID"
= "="
unary_expression
- "-"
decimal_integer_literal "5908509288197150436L"
; ";"
line_comment "// In version 0.9.12, in response to several developer reque"...
line_comment "// the 'data' attribute from 'private' to 'protected', so th"...
line_comment "// make subclasses that work directly with the underlying da"...
block_comment "/** Storage for the data items in the series. */"
field_declaration
modifiers
protected "protected"
type_identifier "List"
variable_declarator
identifier "data"
; ";"
block_comment "/** The maximum number of items for the series. */"
field_declaration
modifiers
private "private"
integral_type
int "int"
variable_declarator
identifier "maximumItemCount"
= "="
field_access
identifier "Integer"
. "."
identifier "MAX_VALUE"
; ";"
block_comment "/** A flag that controls whether the items are automatically"...
field_declaration
modifiers
private "private"
boolean_type "boolean"
variable_declarator
identifier "autoSort"
; ";"
block_comment "/** A flag that controls whether or not duplicate x-values a"...
field_declaration
modifiers
private "private"
boolean_type "boolean"
variable_declarator
identifier "allowDuplicateXValues"
; ";"
block_comment "/**\r\n * Creates a new empty series. By default, items a"...
constructor_declaration (+24 nodes collapsed)
block_comment "/**\r\n * Constructs a new empty series, with the auto-sor"...
constructor_declaration (+28 nodes collapsed)
block_comment "/**\r\n * Constructs a new xy-series that contains no data"...
constructor_declaration (+66 nodes collapsed)
block_comment "/**\r\n * Returns the flag that controls whether the items"...
method_declaration
modifiers
public "public"
boolean_type "boolean"
identifier "getAutoSort"
formal_parameters
( "("
) ")"
block
{ "{"
return_statement
return "return"
field_access
this "this"
. "."
identifier "autoSort"
; ";"
} "}"
block_comment "/**\r\n * Returns a flag that controls whether duplicate x"...
method_declaration
modifiers
public "public"
boolean_type "boolean"
identifier "getAllowDuplicateXValues"
formal_parameters
( "("
) ")"
block
{ "{"
return_statement
return "return"
field_access
this "this"
. "."
identifier "allowDuplicateXValues"
; ";"
} "}"
block_comment "/**\r\n * Returns the number of items in the series.\r\n "...
method_declaration (+25 nodes collapsed)
block_comment "/**\r\n * Returns the list of data items for the series (t"...
method_declaration (+25 nodes collapsed)
block_comment "/**\r\n * Returns the maximum number of items that will be"...
method_declaration
modifiers
public "public"
integral_type
int "int"
identifier "getMaximumItemCount"
formal_parameters
( "("
) ")"
block
{ "{"
return_statement
return "return"
field_access
this "this"
. "."
identifier "maximumItemCount"
; ";"
} "}"
block_comment "/**\r\n * Sets the maximum number of items that will be re"...
method_declaration (+87 nodes collapsed)
block_comment "/**\r\n * Adds a data item to the series and sends a {@lin"...
method_declaration (+25 nodes collapsed)
block_comment "/**\r\n * Adds a data item to the series and sends a {@lin"...
method_declaration (+44 nodes collapsed)
block_comment "/**\r\n * Adds a data item to the series and, if requested"...
method_declaration (+48 nodes collapsed)
block_comment "/**\r\n * Adds a data item to the series and sends a {@lin"...
method_declaration (+35 nodes collapsed)
block_comment "/**\r\n * Adds a data item to the series and, if requested"...
method_declaration (+41 nodes collapsed)
block_comment "/**\r\n * Adds a new data item to the series (in the corre"...
method_declaration (+31 nodes collapsed)
block_comment "/**\r\n * Adds new data to the series and, if requested, s"...
method_declaration (+48 nodes collapsed)
block_comment "/**\r\n * Adds a data item to the series and, if requested"...
method_declaration (+376 nodes collapsed)
block_comment "/**\r\n * Deletes a range of items from the series and sen"...
method_declaration (+63 nodes collapsed)
block_comment "/**\r\n * Removes the item at the specified index and send"...
method_declaration (+47 nodes collapsed)
block_comment "/**\r\n * Removes the item with the specified x-value and "...
method_declaration (+28 nodes collapsed)
block_comment "/**\r\n * Removes all data items from the series.\r\n */"
method_declaration (+51 nodes collapsed)
block_comment "/**\r\n * Return the data item with the specified index.\r\n"...
method_declaration (+33 nodes collapsed)
block_comment "/**\r\n * Returns the x-value at the specified index.\r\n "...
method_declaration (+30 nodes collapsed)
block_comment "/**\r\n * Returns the y-value at the specified index.\r\n "...
method_declaration (+30 nodes collapsed)
block_comment "/**\r\n * Updates the value of an item in the series and s"...
method_declaration (+48 nodes collapsed)
block_comment "/**\r\n * Updates an item in the series.\r\n *\r\n * @"...
method_declaration (+92 nodes collapsed)
block_comment "/**\r\n * Adds or updates an item in the series and sends "...
method_declaration (+43 nodes collapsed)
block_comment "/**\r\n * Adds or updates an item in the series and sends "...
method_declaration
modifiers
public "public"
type_identifier "XYDataItem"
identifier "addOrUpdate"
formal_parameters
( "("
formal_parameter
type_identifier "Number"
identifier "x"
, ","
formal_parameter
type_identifier "Number"
identifier "y"
) ")"
block
{ "{"
if_statement (+25 nodes collapsed)
line_comment "// if we get to here, we know that duplicate X values are no"...
local_variable_declaration
type_identifier "XYDataItem"
variable_declarator
identifier "overwritten"
= "="
null_literal "null"
; ";"
local_variable_declaration
integral_type
int "int"
variable_declarator
identifier "index"
= "="
method_invocation
identifier "indexOf"
argument_list
( "("
identifier "x"
) ")"
; ";"
if_statement
if "if"
parenthesized_expression
( "("
binary_expression
binary_expression
identifier "index"
>= ">="
decimal_integer_literal "0"
&& "&&"
unary_expression
! "!"
field_access
this "this"
. "."
identifier "allowDuplicateXValues"
) ")"
block (+79 nodes collapsed)
else "else"
block (+105 nodes collapsed)
expression_statement
method_invocation
identifier "fireSeriesChanged"
argument_list
( "("
) ")"
; ";"
return_statement
return "return"
identifier "overwritten"
; ";"
} "}"
block_comment "/**\r\n * Returns the index of the item with the specified"...
method_declaration (+140 nodes collapsed)
block_comment "/**\r\n * Returns a new array containing the x and y value"...
method_declaration (+174 nodes collapsed)
block_comment "/**\r\n * Returns a clone of the series.\r\n *\r\n * @"...
method_declaration (+58 nodes collapsed)
block_comment "/**\r\n * Creates a new series by copying a subset of the "...
method_declaration (+188 nodes collapsed)
block_comment "/**\r\n * Tests this series for equality with an arbitrary"...
method_declaration (+184 nodes collapsed)
block_comment "/**\r\n * Returns a hash code.\r\n *\r\n * @return A h"...
method_declaration (+237 nodes collapsed)
} "}"

After

program
block_comment "/* ========================================================="...
package_declaration
package "package"
scoped_identifier
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "jfree"
. "."
identifier "data"
. "."
identifier "xy"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "io"
. "."
identifier "Serializable"
; ";"
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 "List"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "jfree"
. "."
identifier "chart"
. "."
identifier "util"
. "."
identifier "ObjectUtilities"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "jfree"
. "."
identifier "data"
. "."
identifier "general"
. "."
identifier "Series"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "jfree"
. "."
identifier "data"
. "."
identifier "general"
. "."
identifier "SeriesChangeEvent"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "jfree"
. "."
identifier "data"
. "."
identifier "general"
. "."
identifier "SeriesException"
; ";"
block_comment "/**\r\n * Represents a sequence of zero or more data items in "...
class_declaration
modifiers
public "public"
class "class"
identifier "XYSeries"
superclass
extends "extends"
type_identifier "Series"
super_interfaces
implements "implements"
type_list
type_identifier "Cloneable"
, ","
type_identifier "Serializable"
class_body
{ "{"
block_comment "/** For serialization. */"
field_declaration
modifiers
static "static"
final "final"
integral_type
long "long"
variable_declarator
identifier "serialVersionUID"
= "="
unary_expression
- "-"
decimal_integer_literal "5908509288197150436L"
; ";"
line_comment "// In version 0.9.12, in response to several developer reque"...
line_comment "// the 'data' attribute from 'private' to 'protected', so th"...
line_comment "// make subclasses that work directly with the underlying da"...
block_comment "/** Storage for the data items in the series. */"
field_declaration
modifiers
protected "protected"
type_identifier "List"
variable_declarator
identifier "data"
; ";"
block_comment "/** The maximum number of items for the series. */"
field_declaration
modifiers
private "private"
integral_type
int "int"
variable_declarator
identifier "maximumItemCount"
= "="
field_access
identifier "Integer"
. "."
identifier "MAX_VALUE"
; ";"
block_comment "/** A flag that controls whether the items are automatically"...
field_declaration
modifiers
private "private"
boolean_type "boolean"
variable_declarator
identifier "autoSort"
; ";"
block_comment "/** A flag that controls whether or not duplicate x-values a"...
field_declaration
modifiers
private "private"
boolean_type "boolean"
variable_declarator
identifier "allowDuplicateXValues"
; ";"
block_comment "/**\r\n * Creates a new empty series. By default, items a"...
constructor_declaration (+24 nodes collapsed)
block_comment "/**\r\n * Constructs a new empty series, with the auto-sor"...
constructor_declaration (+28 nodes collapsed)
block_comment "/**\r\n * Constructs a new xy-series that contains no data"...
constructor_declaration (+66 nodes collapsed)
block_comment "/**\r\n * Returns the flag that controls whether the items"...
method_declaration
modifiers
public "public"
boolean_type "boolean"
identifier "getAutoSort"
formal_parameters
( "("
) ")"
block
{ "{"
return_statement
return "return"
field_access
this "this"
. "."
identifier "autoSort"
; ";"
} "}"
block_comment "/**\r\n * Returns a flag that controls whether duplicate x"...
method_declaration
modifiers
public "public"
boolean_type "boolean"
identifier "getAllowDuplicateXValues"
formal_parameters
( "("
) ")"
block
{ "{"
return_statement
return "return"
field_access
this "this"
. "."
identifier "allowDuplicateXValues"
; ";"
} "}"
block_comment "/**\r\n * Returns the number of items in the series.\r\n "...
method_declaration (+25 nodes collapsed)
block_comment "/**\r\n * Returns the list of data items for the series (t"...
method_declaration (+25 nodes collapsed)
block_comment "/**\r\n * Returns the maximum number of items that will be"...
method_declaration
modifiers
public "public"
integral_type
int "int"
identifier "getMaximumItemCount"
formal_parameters
( "("
) ")"
block
{ "{"
return_statement
return "return"
field_access
this "this"
. "."
identifier "maximumItemCount"
; ";"
} "}"
block_comment "/**\r\n * Sets the maximum number of items that will be re"...
method_declaration (+87 nodes collapsed)
block_comment "/**\r\n * Adds a data item to the series and sends a {@lin"...
method_declaration (+25 nodes collapsed)
block_comment "/**\r\n * Adds a data item to the series and sends a {@lin"...
method_declaration (+44 nodes collapsed)
block_comment "/**\r\n * Adds a data item to the series and, if requested"...
method_declaration (+48 nodes collapsed)
block_comment "/**\r\n * Adds a data item to the series and sends a {@lin"...
method_declaration (+35 nodes collapsed)
block_comment "/**\r\n * Adds a data item to the series and, if requested"...
method_declaration (+41 nodes collapsed)
block_comment "/**\r\n * Adds a new data item to the series (in the corre"...
method_declaration (+31 nodes collapsed)
block_comment "/**\r\n * Adds new data to the series and, if requested, s"...
method_declaration (+48 nodes collapsed)
block_comment "/**\r\n * Adds a data item to the series and, if requested"...
method_declaration (+376 nodes collapsed)
block_comment "/**\r\n * Deletes a range of items from the series and sen"...
method_declaration (+63 nodes collapsed)
block_comment "/**\r\n * Removes the item at the specified index and send"...
method_declaration (+47 nodes collapsed)
block_comment "/**\r\n * Removes the item with the specified x-value and "...
method_declaration (+28 nodes collapsed)
block_comment "/**\r\n * Removes all data items from the series.\r\n */"
method_declaration (+51 nodes collapsed)
block_comment "/**\r\n * Return the data item with the specified index.\r\n"...
method_declaration (+33 nodes collapsed)
block_comment "/**\r\n * Returns the x-value at the specified index.\r\n "...
method_declaration (+30 nodes collapsed)
block_comment "/**\r\n * Returns the y-value at the specified index.\r\n "...
method_declaration (+30 nodes collapsed)
block_comment "/**\r\n * Updates the value of an item in the series and s"...
method_declaration (+48 nodes collapsed)
block_comment "/**\r\n * Updates an item in the series.\r\n *\r\n * @"...
method_declaration (+92 nodes collapsed)
block_comment "/**\r\n * Adds or updates an item in the series and sends "...
method_declaration (+43 nodes collapsed)
block_comment "/**\r\n * Adds or updates an item in the series and sends "...
method_declaration
modifiers
public "public"
type_identifier "XYDataItem"
identifier "addOrUpdate"
formal_parameters
( "("
formal_parameter
type_identifier "Number"
identifier "x"
, ","
formal_parameter
type_identifier "Number"
identifier "y"
) ")"
block
{ "{"
if_statement (+25 nodes collapsed)
if_statement
if "if"
parenthesized_expression
( "("
field_access
this "this"
. "."
identifier "allowDuplicateXValues"
) ")"
block
{ "{"
expression_statement
method_invocation
identifier "add"
argument_list
( "("
identifier "x"
, ","
identifier "y"
) ")"
; ";"
return_statement
return "return"
null_literal "null"
; ";"
} "}"
line_comment "// if we get to here, we know that duplicate X values are no"...
local_variable_declaration
type_identifier "XYDataItem"
variable_declarator
identifier "overwritten"
= "="
null_literal "null"
; ";"
local_variable_declaration
integral_type
int "int"
variable_declarator
identifier "index"
= "="
method_invocation
identifier "indexOf"
argument_list
( "("
identifier "x"
) ")"
; ";"
if_statement
if "if"
parenthesized_expression
( "("
binary_expression
identifier "index"
>= ">="
decimal_integer_literal "0"
) ")"
block (+79 nodes collapsed)
else "else"
block (+105 nodes collapsed)
expression_statement
method_invocation
identifier "fireSeriesChanged"
argument_list
( "("
) ")"
; ";"
return_statement
return "return"
identifier "overwritten"
; ";"
} "}"
block_comment "/**\r\n * Returns the index of the item with the specified"...
method_declaration (+140 nodes collapsed)
block_comment "/**\r\n * Returns a new array containing the x and y value"...
method_declaration (+174 nodes collapsed)
block_comment "/**\r\n * Returns a clone of the series.\r\n *\r\n * @"...
method_declaration (+58 nodes collapsed)
block_comment "/**\r\n * Creates a new series by copying a subset of the "...
method_declaration (+188 nodes collapsed)
block_comment "/**\r\n * Tests this series for equality with an arbitrary"...
method_declaration (+184 nodes collapsed)
block_comment "/**\r\n * Returns a hash code.\r\n *\r\n * @return A h"...
method_declaration (+237 nodes collapsed)
} "}"