ChartEditor editor = ChartEditorManager.getChartEditor(this.chart); int result = JOptionPane.showConfirmDialog(this, editor, localizationResources.getString("Chart_Properties"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE); if (result == JOptionPane.OK_OPTION) { editor.updateChart(this.chart); }
StrokeChooserPanel panel = new StrokeChooserPanel(null, this.availableStrokeSamples); int result = JOptionPane.showConfirmDialog(this, panel, localizationResources.getString("Stroke_Selection"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE); if (result == JOptionPane.OK_OPTION) { this.outlineStrokeSample.setStroke(panel.getSelectedStroke()); }
Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/chart/ChartPanel.java File path: /jfreechart-1.0.10/src/org/jfree/chart/editor/DefaultPlotEditor.java
Method name: void doEditChartProperties() Method name: void attemptOutlineStrokeSelection()
Number of AST nodes: 4 Number of AST nodes: 4
1
ChartEditor editor = ChartEditorManager.getChartEditor(this.chart
1
StrokeChooserPanel panel 
2
);
2
            = new StrokeChooserPanel(null, this.availableStrokeSamples);
3
        int result = JOptionPane.showConfirmDialog(this, editor,
3
        int result = JOptionPane.showConfirmDialog(this, panel,
4
                localizationResources.getString("Chart_Properties"),
4
            localizationResources.getString("Stroke_Selection"),
5
                JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE);
5
            JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE);
6
        if (result == JOptionPane.OK_OPTION) {
6
        if (result == JOptionPane.OK_OPTION) {
7
            editor.updateChart(this.chart);
7
            this.outlineStrokeSample.setStroke(panel.getSelectedStroke());
8
        }
8
        }
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)0.2
Clones locationClones are in different classes having the same super class
Number of node comparisons8
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements2
    Number of unmapped statements in the first code fragment2
    Number of unmapped statements in the second code fragment2
    Time elapsed for statement mapping (ms)2.6
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
                                                                                                                                                                              
    1
    StrokeChooserPanel panel = new StrokeChooserPanel(null, this.availableStrokeSamples);
    Preondition Violations
    Unmatched statement StrokeChooserPanel panel=new StrokeChooserPanel(null,this.availableStrokeSamples); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    1
    StrokeChooserPanel panel = new StrokeChooserPanel(null, this.availableStrokeSamples);
    1
    ChartEditor editor = ChartEditorManager.getChartEditor(this.chart);
                                                                                                                                            
    2
    int result = JOptionPane.showConfirmDialog(this, editor, localizationResources.getString("Chart_Properties"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE);
    2
    int result = JOptionPane.showConfirmDialog(this, editor, localizationResources.getString("Chart_Properties"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE);
    2
    int result = JOptionPane.showConfirmDialog(this, panel, localizationResources.getString("Stroke_Selection"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE);
    Differences
    Expression1Expression2Difference
    editorpanelVARIABLE_NAME_MISMATCH
    org.jfree.chart.editor.ChartEditororg.jfree.ui.StrokeChooserPanelVARIABLE_TYPE_MISMATCH
    "Chart_Properties""Stroke_Selection"LITERAL_VALUE_MISMATCH
    Preondition Violations
    Type org.jfree.chart.editor.ChartEditor of variable editor does not match with type org.jfree.ui.StrokeChooserPanel of variable panel
    • Make classes org.jfree.chart.editor.ChartEditor and org.jfree.ui.StrokeChooserPanel extend a common superclass
    2
    int result = JOptionPane.showConfirmDialog(this, panel, localizationResources.getString("Stroke_Selection"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE);
    3
    if (result == JOptionPane.OK_OPTION)
    3
    if (result == JOptionPane.OK_OPTION)
                                                                                                                                      
    4
    this.outlineStrokeSample.setStroke(panel.getSelectedStroke());
    Preondition Violations
    Unmatched statement this.outlineStrokeSample.setStroke(panel.getSelectedStroke()); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    4
    this.outlineStrokeSample.setStroke(panel.getSelectedStroke());
    4
    editor.updateChart(this.chart);
    4
    editor.updateChart(this.chart);
    Preondition Violations
    Unmatched statement editor.updateChart(this.chart); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
                                                                        
    Precondition Violations (4)
    Row Violation
    1Unmatched statement StrokeChooserPanel panel=new StrokeChooserPanel(null,this.availableStrokeSamples); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    2Type org.jfree.chart.editor.ChartEditor of variable editor does not match with type org.jfree.ui.StrokeChooserPanel of variable panel
    3Unmatched statement this.outlineStrokeSample.setStroke(panel.getSelectedStroke()); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    4Unmatched statement editor.updateChart(this.chart); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted