336-1-2

Number result = null; if (dataset != null) { double minimum = 0.0; int categoryCount = dataset.getRowCount(); for (int item = 0; item < categoryCount; item++) { double total = 0.0; int seriesCount = dataset.getColumnCount(); for (int series = 0; series < seriesCount; series++) { Number number = dataset.getValue(series, item); if (number != null) { double value = number.doubleValue(); if (value < 0.0) { total = total + value; // '+', remember value is negative } } } minimum = Math.min(minimum, total); } result = new Double(minimum); } return result;
Number result = null; if (dataset != null) { double maximum = 0.0; int categoryCount = dataset.getColumnCount(); for (int item = 0; item < categoryCount; item++) { double total = 0.0; int seriesCount = dataset.getRowCount(); for (int series = 0; series < seriesCount; series++) { Number number = dataset.getValue(series, item); if (number != null) { double value = number.doubleValue(); if (value > 0.0) { total = total + value; } } } maximum = Math.max(maximum, total); } result = new Double(maximum); } return result;

Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/data/general/DatasetUtilities.java |  | File path: /jfreechart-1.0.10/src/org/jfree/data/general/DatasetUtilities.java
Method name: `Number findMinimumStackedRangeValue(CategoryDataset)` |  | Method name: `Number findMaximumStackedRangeValue(CategoryDataset)`
Number of AST nodes: 16 |  | Number of AST nodes: 16

1

    Number result = null;↵

1

    Number result = null;↵

2

            if (dataset != null) {↵

2

            if (dataset != null) {↵

3

                double minimum = 0.0;↵

3

                double maximum = 0.0;↵

4

                int categoryCount = dataset.getRowCount();↵

4

                int categoryCount = dataset.getColumnCount();↵

5

                for (int item = 0; item < categoryCount; item++) {↵

5

                for (int item = 0; item < categoryCount; item++) {↵

6

                    double total = 0.0;↵

6

                    double total = 0.0;↵

7

                    int seriesCount = dataset.getColumnCount();↵

7

                    int seriesCount = dataset.getRowCount();↵

8

                    for (int series = 0; series < seriesCount; series++) {↵

8

                    for (int series = 0; series < seriesCount; series++) {↵

9

                        Number number = dataset.getValue(series, item);↵

9

                        Number number = dataset.getValue(series, item);↵

10

                        if (number != null) {↵

10

                        if (number != null) {↵

11

                            double value = number.doubleValue();↵

11

                            double value = number.doubleValue();↵

12

                            if (value &lt; 0.0) {↵

12

                            if (value &gt; 0.0) {↵

13

                                total = total + value;↵

13

                                total = total + value;↵

14

                                // '+', remember value is negative↵

15

                            }↵

14

                            }↵

16

                        }↵

15

                        }↵

17

                    }↵

16

                    }↵

18

                    minimum = Math.min(minimum, total);↵

17

                    maximum = Math.max(maximum, total);↵

19

                }↵

18

                }↵

20

                result = new Double(minimum);↵

19

                result = new Double(maximum);↵

21

            }↵

20

            }↵

22

            return result;

21

            return result;

See real code fragment |  | See real code fragment

Summary
Number of common nesting structure subtrees | 0
Number of refactorable cases | 0
Number of non-refactorable cases | 0
Time elapsed for finding largest common nesting structure subtrees (ms) | 0.1
Clones location | Clones are declared in the same class
Number of node comparisons | 1