int selectedIndex = _list.getSelectedIndex(); if (selectedIndex != selectEventListIndex) { _list.setSelectedIndex(selectEventListIndex); }
int tabCount = _tabbedPane.getTabCount(); if(0 <= index && index < tabCount) { _tabbedPane.setSelectedIndex(index); }
Clone fragments detected by clone detection tool
File path: /sql12/app/src/net/sourceforge/squirrel_sql/client/gui/db/BaseList.java File path: /sql12/app/src/net/sourceforge/squirrel_sql/client/session/properties/SessionPropertiesSheet.java
Method name: void selectListEntryAtPoint(Point) Method name: void selectTabIndex(int)
Number of AST nodes: 3 Number of AST nodes: 3
1
int selectedIndex = _list.getSelectedIndex();
1
int tabCount = _tabbedPane.getTabCount();
2
   
3
      if (selectedIndex != selectEventListIndex)
2
      if
4
  
3
(0 <= index && index < tabCount)
5
       {
4
      {
6
            _list.setSelectedIndex(selectEventListIndex);
5
			_tabbedPane.setSelectedIndex(index);
7
         }
6
      }
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
Number of node comparisons5
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements3
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)3.9
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    3
    int selectedIndex = _list.getSelectedIndex();
    3
    int selectedIndex = _list.getSelectedIndex();
    1
    int tabCount = _tabbedPane.getTabCount();
    Differences
    Expression1Expression2Difference
    selectedIndextabCountVARIABLE_NAME_MISMATCH
    getSelectedIndexgetTabCountMETHOD_INVOCATION_NAME_MISMATCH
    _list_tabbedPaneVARIABLE_NAME_MISMATCH
    javax.swing.JListjavax.swing.JTabbedPaneSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression _list cannot be unified with expression _tabbedPane , because common superclass javax.swing.JComponent does not declare member(s) public int getSelectedIndex() , public int getTabCount()
    1
    int tabCount = _tabbedPane.getTabCount();
    4
    if (selectedIndex != selectEventListIndex)
    4
    if (selectedIndex != selectEventListIndex)
    2
    if (0 <= index && index < tabCount)
    Differences
    Expression1Expression2Difference
    !=&&OPERATOR_MISMATCH
    selectedIndex0 <= indexINFIX_LEFT_OPERAND_MISMATCH
    selectEventListIndexindex < tabCountINFIX_RIGHT_OPERAND_MISMATCH
    Preondition Violations
    Expression selectedIndex != selectEventListIndex cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression 0 <= index && index < tabCount cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2
    if (0 <= index && index < tabCount)
    5
    _list.setSelectedIndex(selectEventListIndex);
    5
    _list.setSelectedIndex(selectEventListIndex);
    3
    _tabbedPane.setSelectedIndex(index);
    Differences
    Expression1Expression2Difference
    selectEventListIndexindexVARIABLE_NAME_MISMATCH
    _list_tabbedPaneVARIABLE_NAME_MISMATCH
    javax.swing.JListjavax.swing.JTabbedPaneSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression _list cannot be unified with expression _tabbedPane , because common superclass javax.swing.JComponent does not declare member(s) public void setSelectedIndex(int)
    3
    _tabbedPane.setSelectedIndex(index);
    Precondition Violations (5)
    Row Violation
    1Expression _list cannot be unified with expression _tabbedPane , because common superclass javax.swing.JComponent does not declare member(s) public int getSelectedIndex() , public int getTabCount()
    2Expression selectedIndex != selectEventListIndex cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression 0 <= index && index < tabCount cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Expression _list cannot be unified with expression _tabbedPane , because common superclass javax.swing.JComponent does not declare member(s) public void setSelectedIndex(int)
    5The refactoring of the clones is infeasible, because classes net.sourceforge.squirrel_sql.client.gui.db.BaseList and net.sourceforge.squirrel_sql.client.session.properties.SessionPropertiesSheet do not have a common superclass