/** * @return A List of all column names. */ public List<String> getColumnNames() { List<String> columnNames = new ArrayList<String>(); for (Iterator<ColumnDefinition> it = columns.iterator(); it.hasNext();) { ColumnDefinition cd = it.next(); columnNames.add(cd.getName()); } return columnNames; }
/** * @return A List with all referenced column definitions. */ public List<String> getReferencesColumnNames() { List<String> referencesColumnNames = new ArrayList<String>(); for (ColumnDefinition cd : referencesColumns) { referencesColumnNames.add(cd.getName()); } return referencesColumnNames; }
Clone fragments detected by clone detection tool
File path: /ArgoUML-0.34-src/argouml-sql/src/org/argouml/language/sql/ForeignKeyDefinition.java File path: /ArgoUML-0.34-src/argouml-sql/src/org/argouml/language/sql/ForeignKeyDefinition.java
Method name: List getColumnNames() Method name: List getReferencesColumnNames()
Number of AST nodes: 3 Number of AST nodes: 2
1
/**
1
/**
2
     * @return A List of all column names.
2
     * @return A List with all referenced column definitions.
3
     */
3
     */
4
    public List<String> getColumnNames() {
4
    public List<String> getReferencesColumnNames() {
5
        List<String> columnNames = new ArrayList<String>();
5
        List<String> referencesColumnNames = new ArrayList<String>();
6
        for (Iterator<ColumnDefinition> it = columns.iterator(); it.hasNext();) {
6
        for (ColumnDefinition cd : referencesColumns) {
7
            ColumnDefinition cd = it.next();
7
            referencesColumnNames.add(cd.getName());
8
            columnNames.add(cd.getName());
8
        }
9
        }
9
        return referencesColumnNames;
10
        return columnNames;
10
    }
11
    }
  1. {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)0.0
    Similarity Score0.800
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    2
    for (Iterator<ColumnDefinition> it = columns.iterator(); it.hasNext(); )
    2
    for (Iterator<ColumnDefinition> it = columns.iterator(); it.hasNext(); )
    2
    for (ColumnDefinition cd : referencesColumns)
    Differences
    Expression1Expression2Difference
    columnsreferencesColumnsVARIABLE_NAME_MISMATCH
    2
    for (ColumnDefinition cd : referencesColumns)
    3
    ColumnDefinition cd = it.next();
                                                                      
    4
    columnNames.add(cd.getName());
    4
    columnNames.add(cd.getName());
    3
    referencesColumnNames.add(cd.getName());
    Differences
    Expression1Expression2Difference
    columnNamesreferencesColumnNamesVARIABLE_NAME_MISMATCH
    3
    referencesColumnNames.add(cd.getName());
    Precondition Violations (0)
    Row Violation