String key = subselect==null ? Table.qualify(catalog, schema, name) : subselect; Table table = (Table) tables.get(key); if (table == null) { table = new Table(); table.setAbstract(isAbstract); table.setName(name); table.setSchema(schema); table.setCatalog(catalog); table.setSubselect(subselect); tables.put(key, table); } else { if (!isAbstract) table.setAbstract(false); } return table;
String key = subselect==null ? Table.qualify(catalog, schema, name) : subselect; if ( tables.containsKey(key) ) { throw new DuplicateMappingException("table", name); } Table table = new DenormalizedTable(includedTable); table.setAbstract(isAbstract); table.setName(name); table.setSchema(schema); table.setCatalog(catalog); table.setSubselect(subselect); tables.put(key, table); return table;
Clone fragments detected by clone detection tool
File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/cfg/Mappings.java File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/cfg/Mappings.java
Method name: Table addTable(String, String, String, String, boolean) Method name: Table addDenormalizedTable(String, String, String, boolean, String, Table)
Number of AST nodes: 13 Number of AST nodes: 11
1
String key = subselect==null ?
1
String key = subselect==null ?
2
			Table.qualify(catalog, schema, name) :
2
        		Table.qualify(catalog, schema, name) :
3
			subselect;
3
        		subselect;
4
		Table table = (Table) tables.get(key);
4
		
5
		if (table == null) {
6
			table = new Table(
5
if ( tables.containsKey(key) ) {
6
			throw new DuplicateMappingException("table", name);
7
		}
8
		
7
);
9
		Table table = new DenormalizedTable(includedTable);
8
			table.setAbstract(isAbstract);
10
		table.setAbstract(isAbstract);
9
			table.setName(name);
11
		table.setName(name);
10
			table.setSchema(schema);
12
		table.setSchema(schema);
11
			table.setCatalog(catalog);
13
		table.setCatalog(catalog);
12
			table.setSubselect(subselect);
14
		table.setSubselect(subselect);
13
			tables.put(key, table);
15
		tables.put(key, table);
14
		}
15
		else {
16
			if (!isAbstract) table.setAbstract(false);
17
		}
18
		return table;
16
		return table;
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.1
Clones locationClones are declared in the same class
Number of node comparisons76
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements7
    Number of unmapped statements in the first code fragment3
    Number of unmapped statements in the second code fragment4
    Time elapsed for statement mapping (ms)4.0
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
                                                                                                                                                                      
    1
    String key = subselect == null ? Table.qualify(catalog, schema, name) : subselect;
    3
    if (table == null)
                                            
    4
    table = new Table();
                                              
                                                                                                            
    4
    Table table = new DenormalizedTable(includedTable);
    5
    table.setAbstract(isAbstract);
    5
    table.setAbstract(isAbstract);
    6
    table.setName(name);
    6
    table.setName(name);
    7
    table.setSchema(schema);
    7
    table.setSchema(schema);
    8
    table.setCatalog(catalog);
    8
    table.setCatalog(catalog);
    9
    table.setSubselect(subselect);
    9
    table.setSubselect(subselect);
    10
    tables.put(key, table);
    10
    tables.put(key, table);
    11
    if (!isAbstract)
    11
    if (!isAbstract)
    2
    if (tables.containsKey(key))
    Differences
    Expression1Expression2Difference
    !isAbstracttables.containsKey(key)TYPE_COMPATIBLE_REPLACEMENT
    2
    if (tables.containsKey(key))
                                                                                                              
    3
    throw new DuplicateMappingException("table", name);
    Preondition Violations
    Unmatched throw new DuplicateMappingException("table",name);
    3
    throw new DuplicateMappingException("table", name);
    12
    table.setAbstract(false);
                                                              
                                      
    11
    return table;
    Preondition Violations
    Unmatched return table;
    11
    return table;
    Precondition Violations (2)
    Row Violation
    1Unmatched throw new DuplicateMappingException("table",name);
    2Unmatched return table;