317-1-2

Object[] result = new Object[5]; result[0] = dataset.getRowKey(row).toString(); result[1] = dataset.getColumnKey(column).toString(); Number value = dataset.getValue(row, column); if (getNumberFormat() != null) { result[2] = getNumberFormat().format(value); } else if (getDateFormat() != null) { result[2] = getDateFormat().format(value); } if (dataset instanceof IntervalCategoryDataset) { IntervalCategoryDataset icd = (IntervalCategoryDataset) dataset; Number start = icd.getStartValue(row, column); Number end = icd.getEndValue(row, column); if (getNumberFormat() != null) { result[3] = getNumberFormat().format(start); result[4] = getNumberFormat().format(end); } else if (getDateFormat() != null) { result[3] = getDateFormat().format(start); result[4] = getDateFormat().format(end); } } return result;
Object[] result = new Object[5]; result[0] = dataset.getRowKey(row).toString(); result[1] = dataset.getColumnKey(column).toString(); Number value = dataset.getValue(row, column); if (getNumberFormat() != null) { result[2] = getNumberFormat().format(value); } else if (getDateFormat() != null) { result[2] = getDateFormat().format(value); } if (dataset instanceof IntervalCategoryDataset) { IntervalCategoryDataset icd = (IntervalCategoryDataset) dataset; Number start = icd.getStartValue(row, column); Number end = icd.getEndValue(row, column); if (getNumberFormat() != null) { result[3] = getNumberFormat().format(start); result[4] = getNumberFormat().format(end); } else if (getDateFormat() != null) { result[3] = getDateFormat().format(start); result[4] = getDateFormat().format(end); } } return result;

Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/chart/labels/IntervalCategoryItemLabelGenerator.java |  | File path: /jfreechart-1.0.10/src/org/jfree/chart/labels/IntervalCategoryToolTipGenerator.java
Method name: `Object[] createItemArray(CategoryDataset, int, int)` |  | Method name: `Object[] createItemArray(CategoryDataset, int, int)`
Number of AST nodes: 19 |  | Number of AST nodes: 19

1

    Object[] result = new Object[5];↵

1

    Object[] result = new Object[5];↵

2

            result[0] = dataset.getRowKey(row).toString();↵

2

            result[0] = dataset.getRowKey(row).toString();↵

3

            result[1] = dataset.getColumnKey(column).toString();↵

3

            result[1] = dataset.getColumnKey(column).toString();↵

4

            Number value = dataset.getValue(row, column);↵

4

            Number value = dataset.getValue(row, column);↵

5

            if (getNumberFormat() != null) {↵

5

            if (getNumberFormat() != null) {↵

6

                result[2] = getNumberFormat().format(value);  ↵

6

                result[2] = getNumberFormat().format(value);  ↵

7

            }↵

7

            }↵

8

            else if (getDateFormat() != null) {↵

8

            else if (getDateFormat() != null) {↵

9

                result[2] = getDateFormat().format(value);↵

9

                result[2] = getDateFormat().format(value);↵

10

            }↵

10

            }↵

11

            ↵

11

            ↵

12

            if (dataset instanceof IntervalCategoryDataset) {↵

12

            if (dataset instanceof IntervalCategoryDataset) {↵

13

                IntervalCategoryDataset icd = (IntervalCategoryDataset) dataset;↵

13

                IntervalCategoryDataset icd = (IntervalCategoryDataset) dataset;↵

14

                Number start = icd.getStartValue(row, column);↵

14

                Number start = icd.getStartValue(row, column);↵

15

                Number end = icd.getEndValue(row, column);↵

15

                Number end = icd.getEndValue(row, column);↵

16

                if (getNumberFormat() != null) {↵

16

                if (getNumberFormat() != null) {↵

17

                    result[3] = getNumberFormat().format(start);  ↵

17

                    result[3] = getNumberFormat().format(start);  ↵

18

                    result[4] = getNumberFormat().format(end);  ↵

18

                    result[4] = getNumberFormat().format(end);  ↵

19

                }↵

19

                }↵

20

                else if (getDateFormat() != null) {↵

20

                else if (getDateFormat() != null) {↵

21

                    result[3] = getDateFormat().format(start);↵

21

                    result[3] = getDateFormat().format(start);↵

22

                    result[4] = getDateFormat().format(end);↵

22

                    result[4] = getDateFormat().format(end);↵

23

                }↵

23

                }↵

24

            }↵

24

            }↵

25

            return result;

25

            return result;

See real code fragment |  | See real code fragment

Summary
Number of common nesting structure subtrees | 1
Number of refactorable cases | 1
Number of non-refactorable cases | 0
Time elapsed for finding largest common nesting structure subtrees (ms) | 0.5
Clones location | Clones are in different classes having the same super class
Number of node comparisons | 82

1. {Refactorable}

   Mapping Summary
   Number of mapped statements | 19
   Number of unmapped statements in the first code fragment | 0
   Number of unmapped statements in the second code fragment | 0
   Time elapsed for statement mapping (ms) | 3.6
   Clone type | Type 1

   Mapped Statements
   ID | Statement |  | ID | Statement
   --- | --- | --- | --- | ---

   1

       Object[] result = new Object[5];

   1

       Object[] result = new Object[5];

   2

       result[0] = dataset.getRowKey(row).toString();

   2

       result[0] = dataset.getRowKey(row).toString();

   3

       result[1] = dataset.getColumnKey(column).toString();

   3

       result[1] = dataset.getColumnKey(column).toString();

   4

       Number value = dataset.getValue(row, column);

   4

       Number value = dataset.getValue(row, column);

   5

       if (getNumberFormat() != null)

   5

       if (getNumberFormat() != null)

   6

       result[2] = getNumberFormat().format(value);

   6

       result[2] = getNumberFormat().format(value);

   7

       else if (getDateFormat() != null)

   7

       else if (getDateFormat() != null)

   8

       result[2] = getDateFormat().format(value);

   8

       result[2] = getDateFormat().format(value);

   9

       if (dataset instanceof IntervalCategoryDataset)

   9

       if (dataset instanceof IntervalCategoryDataset)

   10

       IntervalCategoryDataset icd = (IntervalCategoryDataset)dataset;

   10

       IntervalCategoryDataset icd = (IntervalCategoryDataset)dataset;

   11

       Number start = icd.getStartValue(row, column);

   11

       Number start = icd.getStartValue(row, column);

   12

       Number end = icd.getEndValue(row, column);

   12

       Number end = icd.getEndValue(row, column);

   13

       if (getNumberFormat() != null)

   13

       if (getNumberFormat() != null)

   14

       result[3] = getNumberFormat().format(start);

   14

       result[3] = getNumberFormat().format(start);

   15

       result[4] = getNumberFormat().format(end);

   15

       result[4] = getNumberFormat().format(end);

   16

       else if (getDateFormat() != null)

   16

       else if (getDateFormat() != null)

   17

       result[3] = getDateFormat().format(start);

   17

       result[3] = getDateFormat().format(start);

   18

       result[4] = getDateFormat().format(end);

   18

       result[4] = getDateFormat().format(end);

   19

       return result;

   19

       return result;

   Precondition Violations (0)
   Row | Violation
   --- | ---