if (evt.getSource() instanceof FontButton) { FontButton btn = (FontButton) evt.getSource(); FontInfo fi = btn.getFontInfo(); Font font = null; if (fi != null) { font = fi.createFont(); } font = new FontChooser().showDialog(font); if (font != null) { btn.setSelectedFont(font); btn._lbl.setText(new FontInfo(font).toString()); } }
if (evt.getSource() instanceof FontButton) { FontButton btn = (FontButton) evt.getSource(); FontInfo fi = btn.getFontInfo(); Font font = null; if (fi != null) { font = fi.createFont(); } font = new FontChooser().showDialog(font); if (font != null) { btn.setSelectedFont(font); btn._lbl.setText(new FontInfo(font).toString()); } }
Clone fragments detected by clone detection tool
File path: /sql12/app/src/net/sourceforge/squirrel_sql/client/session/properties/SessionSQLPropertiesPanel.java File path: /sql12/plugins/laf/src/net/sourceforge/squirrel_sql/plugins/laf/LAFFontsTab.java
Method name: void actionPerformed(ActionEvent) Method name: void actionPerformed(ActionEvent)
Number of AST nodes: 10 Number of AST nodes: 10
1
if (evt.getSource() instanceof FontButton)
1
if (evt.getSource() instanceof FontButton)
2
				{
2
				{
3
					FontButton btn = (FontButton) evt.getSource();
3
					FontButton btn = (FontButton) evt.getSource();
4
					FontInfo fi = btn.getFontInfo();
4
					FontInfo fi = btn.getFontInfo();
5
					Font font = null;
5
					Font font = null;
6
					if (fi != null)
6
					if (fi != null)
7
					{
7
					{
8
						font = fi.createFont();
8
						font = fi.createFont();
9
					}
9
					}
10
					font = new FontChooser().showDialog(font);
10
					font = new FontChooser().showDialog(font);
11
					if (font != null)
11
					if (font != null)
12
					{
12
					{
13
						btn.setSelectedFont(font);
13
						btn.setSelectedFont(font);
14
						btn._lbl.setText(new FontInfo(font).toString());
14
						btn._lbl.setText(new FontInfo(font).toString());
15
					}
15
					}
16
				}
16
				}
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.8
Clones locationClones are in different classes
Number of node comparisons45
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements10
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)18.3
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    if (evt.getSource() instanceof FontButton)
    1
    if (evt.getSource() instanceof FontButton)
    1
    if (evt.getSource() instanceof FontButton)
    Differences
    Expression1Expression2Difference
    net.sourceforge.squirrel_sql.client.session.properties.SessionSQLPropertiesPanel.SQLPropertiesPanel.FontButtonnet.sourceforge.squirrel_sql.plugins.laf.LAFFontsTab.FontSelectionPanel.FontButtonSUBCLASS_TYPE_MISMATCH
    1
    if (evt.getSource() instanceof FontButton)
    2
    FontButton btn = (FontButton)evt.getSource();
    2
    FontButton btn = (FontButton)evt.getSource();
    2
    FontButton btn = (FontButton)evt.getSource();
    Differences
    Expression1Expression2Difference
    net.sourceforge.squirrel_sql.client.session.properties.SessionSQLPropertiesPanel.SQLPropertiesPanel.FontButtonnet.sourceforge.squirrel_sql.plugins.laf.LAFFontsTab.FontSelectionPanel.FontButtonSUBCLASS_TYPE_MISMATCH
    net.sourceforge.squirrel_sql.client.session.properties.SessionSQLPropertiesPanel.SQLPropertiesPanel.FontButtonnet.sourceforge.squirrel_sql.plugins.laf.LAFFontsTab.FontSelectionPanel.FontButtonSUBCLASS_TYPE_MISMATCH
    net.sourceforge.squirrel_sql.client.session.properties.SessionSQLPropertiesPanel.SQLPropertiesPanel.FontButtonnet.sourceforge.squirrel_sql.plugins.laf.LAFFontsTab.FontSelectionPanel.FontButtonSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression (FontButton)evt.getSource() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression (FontButton)evt.getSource() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2
    FontButton btn = (FontButton)evt.getSource();
    3
    FontInfo fi = btn.getFontInfo();
    3
    FontInfo fi = btn.getFontInfo();
    3
    FontInfo fi = btn.getFontInfo();
    Differences
    Expression1Expression2Difference
    net.sourceforge.squirrel_sql.client.session.properties.SessionSQLPropertiesPanel.SQLPropertiesPanel.FontButtonnet.sourceforge.squirrel_sql.plugins.laf.LAFFontsTab.FontSelectionPanel.FontButtonSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression btn cannot be unified with expression btn , because common superclass javax.swing.JButton does not declare member(s) net.sourceforge.squirrel_sql.fw.gui.FontInfo getFontInfo()
    3
    FontInfo fi = btn.getFontInfo();
    4
    Font font = null;
    4
    Font font = null;
    5
    if (fi != null)
    5
    if (fi != null)
    6
    font = fi.createFont();
    6
    font = fi.createFont();
    7
    font = new FontChooser().showDialog(font);
    7
    font = new FontChooser().showDialog(font);
    8
    if (font != null)
    8
    if (font != null)
    9
    btn.setSelectedFont(font);
    9
    btn.setSelectedFont(font);
    9
    btn.setSelectedFont(font);
    Differences
    Expression1Expression2Difference
    net.sourceforge.squirrel_sql.client.session.properties.SessionSQLPropertiesPanel.SQLPropertiesPanel.FontButtonnet.sourceforge.squirrel_sql.plugins.laf.LAFFontsTab.FontSelectionPanel.FontButtonSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression btn cannot be unified with expression btn , because common superclass javax.swing.JButton does not declare member(s) void setSelectedFont(java.awt.Font)
    9
    btn.setSelectedFont(font);
    10
    btn._lbl.setText(new FontInfo(font).toString());
    10
    btn._lbl.setText(new FontInfo(font).toString());
    10
    btn._lbl.setText(new FontInfo(font).toString());
    Differences
    Expression1Expression2Difference
    net.sourceforge.squirrel_sql.client.session.properties.SessionSQLPropertiesPanel.SQLPropertiesPanel.FontButtonnet.sourceforge.squirrel_sql.plugins.laf.LAFFontsTab.FontSelectionPanel.FontButtonSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression btn._lbl cannot be unified with expression btn._lbl , because common superclass javax.swing.JButton does not declare member(s) private javax.swing.JLabel _lbl
    10
    btn._lbl.setText(new FontInfo(font).toString());
    Precondition Violations (5)
    Row Violation
    1Expression (FontButton)evt.getSource() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression (FontButton)evt.getSource() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression btn cannot be unified with expression btn , because common superclass javax.swing.JButton does not declare member(s) net.sourceforge.squirrel_sql.fw.gui.FontInfo getFontInfo()
    4Expression btn cannot be unified with expression btn , because common superclass javax.swing.JButton does not declare member(s) void setSelectedFont(java.awt.Font)
    5Expression btn._lbl cannot be unified with expression btn._lbl , because common superclass javax.swing.JButton does not declare member(s) private javax.swing.JLabel _lbl