for (int i = 0; i < m_optionDescriptors.length; i++) { if (m_optionDescriptors[i].getName().equals(name)) { return m_optionDescriptors[i]; } } return null;
for (int i = 0; i < m_optionDescriptors.length; i++) { if (m_optionDescriptors[i].getId() == id) { return m_optionDescriptors[i]; } } return null;
Clone fragments detected by clone detection tool
File path: /jakarta-jmeter-2.3.2/src/org/apache/commons/cli/avalon/CLArgsParser.java File path: /jakarta-jmeter-2.3.2/src/org/apache/commons/cli/avalon/CLArgsParser.java
Method name: CLOptionDescriptor getDescriptorFor(String) Method name: CLOptionDescriptor getDescriptorFor(int)
Number of AST nodes: 4 Number of AST nodes: 4
1
for (int i = 0; i < m_optionDescriptors.length; i++) {
1
for (int i = 0; i < m_optionDescriptors.length; i++) {
2
			if (m_optionDescriptors[i].getName().equals(name)) {
2
			if (m_optionDescriptors[i].getId() == id) {
3
				return m_optionDescriptors[i];
3
				return m_optionDescriptors[i];
4
			}
4
			}
5
		}
5
		}
6
		return null;
6
		return null;
Summary
Number of common nesting structure subtrees1
Number of refactorable cases1
Number of non-refactorable cases0
Time elapsed for finding largest common nesting structure subtrees (ms)0.1
Clones locationClones are declared in the same class
Number of node comparisons3
  1. {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)1.3
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    1
    for (int i = 0; i < m_optionDescriptors.length; i++)
    1
    for (int i = 0; i < m_optionDescriptors.length; i++)
                                                                                          
    2
    if (m_optionDescriptors[i].getId() == id)
    Preondition Violations
    Unmatched statement if(m_optionDescriptors[i].getId() == id) cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    2
    if (m_optionDescriptors[i].getId() == id)
                                                                      
    3
    return m_optionDescriptors[i];
    Preondition Violations
    Unmatched statement return m_optionDescriptors[i]; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    Unmatched return m_optionDescriptors[i];
    3
    return m_optionDescriptors[i];
    2
    if (m_optionDescriptors[i].getName().equals(name))
    2
    if (m_optionDescriptors[i].getName().equals(name))
    Preondition Violations
    Unmatched statement if(m_optionDescriptors[i].getName().equals(name)) cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                                            
    3
    return m_optionDescriptors[i];
    3
    return m_optionDescriptors[i];
    Preondition Violations
    Unmatched statement return m_optionDescriptors[i]; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    Unmatched return m_optionDescriptors[i];
                                                                      
    4
    return null;
    4
    return null;
    Precondition Violations (6)
    Row Violation
    1Unmatched statement if(m_optionDescriptors[i].getId() == id) cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    2Unmatched statement return m_optionDescriptors[i]; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3Unmatched return m_optionDescriptors[i];
    4Unmatched statement if(m_optionDescriptors[i].getName().equals(name)) cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    5Unmatched statement return m_optionDescriptors[i]; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    6Unmatched return m_optionDescriptors[i];