307-1-2

String result = null; if (series < getListCount()) { List tooltips = (List) this.toolTipSeries.get(series); if (tooltips != null) { if (item < tooltips.size()) { result = (String) tooltips.get(item); } } } return result;
String result = null; if (series < getListCount()) { List urls = (List) this.urlSeries.get(series); if (urls != null) { if (item < urls.size()) { result = (String) urls.get(item); } } } return result;

Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/chart/labels/CustomXYToolTipGenerator.java |  | File path: /jfreechart-1.0.10/src/org/jfree/chart/urls/CustomCategoryURLGenerator.java
Method name: `String getToolTipText(int, int)` |  | Method name: `String getURL(int, int)`
Number of AST nodes: 7 |  | Number of AST nodes: 7

1

    String result = null;↵

1

    String result = null;↵

2

            if (series < getListCount()) {↵

2

            if (series < getListCount()) {↵

3

                List tooltips = (List) this.toolTipSeries.get(series);↵

3

                List urls = (List) this.urlSeries.get(series);↵

4

                if (tooltips != null) {↵

4

                if (urls != null) {↵

5

                    if (item < tooltips.size()) {↵

5

                    if (item < urls.size()) {↵

6

                        result = (String) tooltips.get(item);↵

6

                        result = (String) urls.get(item);↵

7

                    }↵

7

                    }↵

8

                }↵

8

                }↵

9

            }↵

9

            }↵

10

            return result;

10

            return result;

See real code fragment |  | See real code fragment

Summary
Number of common nesting structure subtrees | 1
Number of refactorable cases | 0
Number of non-refactorable cases | 1
Time elapsed for finding largest common nesting structure subtrees (ms) | 0.2
Clones location | Clones are in different classes
Number of node comparisons | 13

1. {Non-refactorable}

   Mapping Summary
   Number of mapped statements | 7
   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) | 0.7
   Clone type | Type 2

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

   1

       String result = null;

   1

       String result = null;

   2

       if (series < getListCount())

   2

       if (series < getListCount())

   3

       List tooltips = (List)this.toolTipSeries.get(series);

   3 | List tooltips = (List)this.toolTipSeries.get(series);
   3 | List urls = (List)this.urlSeries.get(series);

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   tooltips | urls | VARIABLE_NAME_MISMATCH
   toolTipSeries | urlSeries | VARIABLE_NAME_MISMATCH
   java.util.List | java.util.ArrayList | VARIABLE_TYPE_MISMATCH

   Preondition Violations

   Type java.util.List of variable this.toolTipSeries does not match with type java.util.ArrayList of variable this.urlSeries
   - Make classes java.util.List and java.util.ArrayList extend a common superclass

   3

       List urls = (List)this.urlSeries.get(series);

   4

       if (tooltips != null)

   4 | if (tooltips != null)
   4 | if (urls != null)

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   tooltips | urls | VARIABLE_NAME_MISMATCH

   4

       if (urls != null)

   5

       if (item < tooltips.size())

   5 | if (item < tooltips.size())
   5 | if (item < urls.size())

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   tooltips | urls | VARIABLE_NAME_MISMATCH

   5

       if (item < urls.size())

   6

       result = (String)tooltips.get(item);

   6 | result = (String)tooltips.get(item);
   6 | result = (String)urls.get(item);

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   tooltips | urls | VARIABLE_NAME_MISMATCH

   6

       result = (String)urls.get(item);

   7

       return result;

   7

       return result;

   Precondition Violations (1)
   Row | Violation
   --- | ---
   1 | Type java.util.List of variable this.toolTipSeries does not match with type java.util.ArrayList of variable this.urlSeries