String command = event.getActionCommand(); if (command.equals("GridStroke")) { attemptGridStrokeSelection(); } else if (command.equals("GridPaint")) { attemptGridPaintSelection(); } else if (command.equals("AutoRangeOnOff")) { toggleAutoRange(); } else if (command.equals("MinimumRange")) { validateMinimum(); } else if (command.equals("MaximumRange")) { validateMaximum(); } else { // pass to the super-class for handling super.actionPerformed(event); }
String command = event.getActionCommand(); if (command.equals("BackgroundPaint")) { attemptBackgroundPaintSelection(); } else if (command.equals("OutlineStroke")) { attemptOutlineStrokeSelection(); } else if (command.equals("OutlinePaint")) { attemptOutlinePaintSelection(); } // else if (command.equals("Insets")) { // editInsets(); // } else if (command.equals("Orientation")) { attemptOrientationSelection(); } else if (command.equals("DrawLines")) { attemptDrawLinesSelection(); } else if (command.equals("DrawShapes")) { attemptDrawShapesSelection(); }
Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/chart/editor/DefaultNumberAxisEditor.java File path: /jfreechart-1.0.10/src/org/jfree/chart/editor/DefaultPlotEditor.java
Method name: void actionPerformed(ActionEvent) Method name: void actionPerformed(ActionEvent)
Number of AST nodes: 12 Number of AST nodes: 13
1
String command = event.getActionCommand();
1
String command = event.getActionCommand();
2
        if (command.equals("GridStroke")) {
2
        if (command.equals("BackgroundPaint")) {
3
            attemptGridStrokeSelection();
3
            attemptBackgroundPaintSelection();
4
        }
4
        }
5
        else if (command.equals("GridPaint")) {
5
        else if (command.equals("OutlineStroke")) {
6
            attemptGridPaintSelection();
6
            attemptOutlineStrokeSelection();
7
        }
7
        }
8
        else if (command.equals("AutoRangeOnOff")) {
8
        else if (command.equals("OutlinePaint")) {
9
            toggleAutoRange();
9
            attemptOutlinePaintSelection();
10
        }
10
        }
11
        else if (command.equals("MinimumRange")) {
11
//        else if (command.equals("Insets")) {
12
            validateMinimum();
12
//            editInsets();
13
        }
13
//        }
14
        else if (command.equals("MaximumRange")) {
14
        else if (command.equals("Orientation")) {
15
            validateMaximum();
15
            attemptOrientationSelection();
16
        }
16
        }
17
        else {
17
        else 
18
            // pass to the super-class for handling
19
            super.actionPerformed(event
18
if (command.equals("DrawLines")) {
19
            attemptDrawLinesSelection();
20
        }
21
        else if (command.equals("DrawShapes")) {
20
);
22
            attemptDrawShapesSelection();
21
        }
23
        }
Summary
Number of common nesting structure subtrees1
Number of refactorable cases0
Number of non-refactorable cases1
Time elapsed for finding largest common nesting structure subtrees (ms)1.4
Clones locationClones are in different classes having the same super class
Number of node comparisons95
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements11
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment12
    Time elapsed for statement mapping (ms)4.7
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    1
    String command = event.getActionCommand();
    1
    String command = event.getActionCommand();
                                                                                    
    2
    if (command.equals("BackgroundPaint"))
    Preondition Violations
    Unmatched statement if(command.equals("BackgroundPaint")) cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    2
    if (command.equals("BackgroundPaint"))
                                                                              
    3
    attemptBackgroundPaintSelection();
    Preondition Violations
    Unmatched statement attemptBackgroundPaintSelection(); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    3
    attemptBackgroundPaintSelection();
                                                                                
    4
    else if (command.equals("OutlineStroke"))
    Preondition Violations
    Unmatched statement if(command.equals("OutlineStroke")) cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4
    else if (command.equals("OutlineStroke"))
    2
    if (command.equals("GridStroke"))
    2
    if (command.equals("GridStroke"))
    4
    if (command.equals("OutlineStroke"))
    Differences
    Expression1Expression2Difference
    "GridStroke""OutlineStroke"LITERAL_VALUE_MISMATCH
    4
    if (command.equals("OutlineStroke"))
                                                                          
    5
    attemptOutlineStrokeSelection();
    Preondition Violations
    Unmatched statement attemptOutlineStrokeSelection(); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    5
    attemptOutlineStrokeSelection();
    3
    attemptGridStrokeSelection();
    3
    attemptGridStrokeSelection();
    5
    attemptOutlineStrokeSelection();
    Differences
    Expression1Expression2Difference
    attemptGridStrokeSelectionattemptOutlineStrokeSelectionMETHOD_INVOCATION_NAME_MISMATCH
    Preondition Violations
    Expression attemptGridStrokeSelection() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    • Inline private method attemptGridStrokeSelection
    Expression attemptGridStrokeSelection() is a void method call, and thus it cannot be parameterized
    Expression attemptOutlineStrokeSelection() is a void method call, and thus it cannot be parameterized
    5
    attemptOutlineStrokeSelection();
                                                                              
    6
    else if (command.equals("OutlinePaint"))
    Preondition Violations
    Unmatched statement if(command.equals("OutlinePaint")) cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    6
    else if (command.equals("OutlinePaint"))
                                                                        
    7
    attemptOutlinePaintSelection();
    Preondition Violations
    Unmatched statement attemptOutlinePaintSelection(); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    7
    attemptOutlinePaintSelection();
                                                                            
    8
    else if (command.equals("Orientation"))
    Preondition Violations
    Unmatched statement if(command.equals("Orientation")) cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    8
    else if (command.equals("Orientation"))
                                                                      
    9
    attemptOrientationSelection();
    Preondition Violations
    Unmatched statement attemptOrientationSelection(); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    9
    attemptOrientationSelection();
                                                                          
    10
    else if (command.equals("DrawLines"))
    Preondition Violations
    Unmatched statement if(command.equals("DrawLines")) cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    10
    else if (command.equals("DrawLines"))
                                                                    
    11
    attemptDrawLinesSelection();
    Preondition Violations
    Unmatched statement attemptDrawLinesSelection(); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    11
    attemptDrawLinesSelection();
                                                                            
    12
    else if (command.equals("DrawShapes"))
    Preondition Violations
    Unmatched statement if(command.equals("DrawShapes")) cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    12
    else if (command.equals("DrawShapes"))
                                                                      
    13
    attemptDrawShapesSelection();
    Preondition Violations
    Unmatched statement attemptDrawShapesSelection(); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    13
    attemptDrawShapesSelection();
    4
    else if (command.equals("GridPaint"))
    4
    else if (command.equals("GridPaint"))
    6
    else if (command.equals("OutlinePaint"))
    Differences
    Expression1Expression2Difference
    "GridPaint""OutlinePaint"LITERAL_VALUE_MISMATCH
    6
    else if (command.equals("OutlinePaint"))
    5
    attemptGridPaintSelection();
    5
    attemptGridPaintSelection();
    7
    attemptOutlinePaintSelection();
    Differences
    Expression1Expression2Difference
    attemptGridPaintSelectionattemptOutlinePaintSelectionMETHOD_INVOCATION_NAME_MISMATCH
    Preondition Violations
    Expression attemptGridPaintSelection() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    • Inline private method attemptGridPaintSelection
    Expression attemptGridPaintSelection() is a void method call, and thus it cannot be parameterized
    Expression attemptOutlinePaintSelection() is a void method call, and thus it cannot be parameterized
    7
    attemptOutlinePaintSelection();
    6
    else if (command.equals("AutoRangeOnOff"))
    6
    else if (command.equals("AutoRangeOnOff"))
    8
    else if (command.equals("Orientation"))
    Differences
    Expression1Expression2Difference
    "AutoRangeOnOff""Orientation"LITERAL_VALUE_MISMATCH
    8
    else if (command.equals("Orientation"))
    7
    toggleAutoRange();
    7
    toggleAutoRange();
    9
    attemptOrientationSelection();
    Differences
    Expression1Expression2Difference
    toggleAutoRangeattemptOrientationSelectionMETHOD_INVOCATION_NAME_MISMATCH
    Preondition Violations
    Expression toggleAutoRange() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression toggleAutoRange() is a void method call, and thus it cannot be parameterized
    Expression attemptOrientationSelection() is a void method call, and thus it cannot be parameterized
    9
    attemptOrientationSelection();
    8
    else if (command.equals("MinimumRange"))
    8
    else if (command.equals("MinimumRange"))
    10
    else if (command.equals("DrawLines"))
    Differences
    Expression1Expression2Difference
    "MinimumRange""DrawLines"LITERAL_VALUE_MISMATCH
    10
    else if (command.equals("DrawLines"))
    9
    validateMinimum();
    9
    validateMinimum();
    11
    attemptDrawLinesSelection();
    Differences
    Expression1Expression2Difference
    validateMinimumattemptDrawLinesSelectionMETHOD_INVOCATION_NAME_MISMATCH
    Preondition Violations
    Expression validateMinimum() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression validateMinimum() is a void method call, and thus it cannot be parameterized
    Expression attemptDrawLinesSelection() is a void method call, and thus it cannot be parameterized
    11
    attemptDrawLinesSelection();
    10
    else if (command.equals("MaximumRange"))
    10
    else if (command.equals("MaximumRange"))
    12
    else if (command.equals("DrawShapes"))
    Differences
    Expression1Expression2Difference
    "MaximumRange""DrawShapes"LITERAL_VALUE_MISMATCH
    12
    else if (command.equals("DrawShapes"))
    11
    validateMaximum();
    11
    validateMaximum();
    13
    attemptDrawShapesSelection();
    Differences
    Expression1Expression2Difference
    validateMaximumattemptDrawShapesSelectionMETHOD_INVOCATION_NAME_MISMATCH
    Preondition Violations
    Expression validateMaximum() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression validateMaximum() is a void method call, and thus it cannot be parameterized
    Expression attemptDrawShapesSelection() is a void method call, and thus it cannot be parameterized
    13
    attemptDrawShapesSelection();
    else
            
    12
    super.actionPerformed(event);
                                                                      
    Precondition Violations (28)
    Row Violation
    1Unmatched statement if(command.equals("BackgroundPaint")) cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    2Unmatched statement attemptBackgroundPaintSelection(); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    3Unmatched statement if(command.equals("OutlineStroke")) cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4Unmatched statement attemptOutlineStrokeSelection(); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    5Expression attemptGridStrokeSelection() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6Expression attemptGridStrokeSelection() is a void method call, and thus it cannot be parameterized
    7Expression attemptOutlineStrokeSelection() is a void method call, and thus it cannot be parameterized
    8Unmatched statement if(command.equals("OutlinePaint")) cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    9Unmatched statement attemptOutlinePaintSelection(); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    10Unmatched statement if(command.equals("Orientation")) cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    11Unmatched statement attemptOrientationSelection(); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    12Unmatched statement if(command.equals("DrawLines")) cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    13Unmatched statement attemptDrawLinesSelection(); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    14Unmatched statement if(command.equals("DrawShapes")) cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    15Unmatched statement attemptDrawShapesSelection(); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    16Expression attemptGridPaintSelection() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    17Expression attemptGridPaintSelection() is a void method call, and thus it cannot be parameterized
    18Expression attemptOutlinePaintSelection() is a void method call, and thus it cannot be parameterized
    19Expression toggleAutoRange() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    20Expression toggleAutoRange() is a void method call, and thus it cannot be parameterized
    21Expression attemptOrientationSelection() is a void method call, and thus it cannot be parameterized
    22Expression validateMinimum() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    23Expression validateMinimum() is a void method call, and thus it cannot be parameterized
    24Expression attemptDrawLinesSelection() is a void method call, and thus it cannot be parameterized
    25Expression validateMaximum() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    26Expression validateMaximum() is a void method call, and thus it cannot be parameterized
    27Expression attemptDrawShapesSelection() is a void method call, and thus it cannot be parameterized
    28The refactoring of the clones is infeasible, because classes org.jfree.chart.editor.DefaultNumberAxisEditor and org.jfree.chart.editor.DefaultPlotEditor do not have a common superclass