private void addEntries(BibtexDatabase database, Set<String> keySet) { entries = new HashSet<MSBibEntry>(); for (String s : keySet){ BibtexEntry entry = database.getEntryById(s); MSBibEntry newMods = new MSBibEntry(entry); entries.add(newMods); } }
private void addEntries(BibtexDatabase database, Set<String> keySet) { entries = new HashSet<MODSEntry>(); for(Iterator<String> iter = keySet.iterator(); iter.hasNext(); ) { BibtexEntry entry = database.getEntryById(iter.next()); MODSEntry newMods = new MODSEntry(entry); entries.add(newMods); } }
Clone fragments detected by clone detection tool
File path: /jabref-2.10/src/java/net/sf/jabref/msbib/MSBibDatabase.java File path: /jabref-2.10/src/java/net/sf/jabref/mods/MODSDatabase.java
Method name: void addEntries(BibtexDatabase, Set) Method name: void addEntries(BibtexDatabase, Set)
Number of AST nodes: 4 Number of AST nodes: 4
1
private void addEntries(BibtexDatabase database, Set<String> keySet) {
1
private void addEntries(BibtexDatabase database, Set<String> keySet) {
2
        entries = new HashSet<MSBibEntry>();
2
        entries = new HashSet<MODSEntry>();
3
        for (String s : keySet){
3
        for(Iterator<String> iter = keySet.iterator(); iter.hasNext(); ) {
4
        	BibtexEntry entry = database.getEntryById(s);
4
			BibtexEntry entry = database.getEntryById(iter.next());
5
			MSBibEntry newMods = new MSBibEntry(entry);
5
			MODSEntry newMods = new MODSEntry(entry);
6
			entries.add(newMods);
6
			entries.add(newMods);
7
		}
7
		}
8
	}
8
	}
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements3
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)0.0
    Similarity Score0.400
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    2
    for (String s : keySet)
    2
    for (Iterator<String> iter = keySet.iterator(); iter.hasNext(); )
    3
    BibtexEntry entry = database.getEntryById(s);
    3
    BibtexEntry entry = database.getEntryById(s);
    3
    BibtexEntry entry = database.getEntryById(iter.next());
    Differences
    Expression1Expression2Difference
    siter.next()TYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression s cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3
    BibtexEntry entry = database.getEntryById(iter.next());
                                                                                        
    4
    MODSEntry newMods = new MODSEntry(entry);
    Preondition Violations
    Unmatched statement MODSEntry newMods=new MODSEntry(entry); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4
    MODSEntry newMods = new MODSEntry(entry);
    4
    MSBibEntry newMods = new MSBibEntry(entry);
    4
    MSBibEntry newMods = new MSBibEntry(entry);
    Preondition Violations
    Unmatched statement MSBibEntry newMods=new MSBibEntry(entry); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                            
    5
    entries.add(newMods);
    5
    entries.add(newMods);
    5
    entries.add(newMods);
    Differences
    Expression1Expression2Difference
    net.sf.jabref.msbib.MSBibEntrynet.sf.jabref.mods.MODSEntryVARIABLE_TYPE_MISMATCH
    java.util.Setjava.util.SetVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type net.sf.jabref.msbib.MSBibEntry of variable newMods does not match with type net.sf.jabref.mods.MODSEntry of variable newMods
    • Make classes net.sf.jabref.msbib.MSBibEntry and net.sf.jabref.mods.MODSEntry extend a common superclass
    Type java.util.Set<net.sf.jabref.msbib.MSBibEntry> of variable entries does not match with type java.util.Set<net.sf.jabref.mods.MODSEntry> of variable entries
    • Make classes java.util.Set and java.util.Set extend a common superclass
    5
    entries.add(newMods);
    Precondition Violations (5)
    Row Violation
    1Expression s cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Unmatched statement MODSEntry newMods=new MODSEntry(entry); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3Unmatched statement MSBibEntry newMods=new MSBibEntry(entry); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4Type net.sf.jabref.msbib.MSBibEntry of variable newMods does not match with type net.sf.jabref.mods.MODSEntry of variable newMods
    5Type java.util.Set<net.sf.jabref.msbib.MSBibEntry> of variable entries does not match with type java.util.Set<net.sf.jabref.mods.MODSEntry> of variable entries