/** * If an autocompleter exists for the "journal" field, add all * journal names in the journal abbreviation list to this autocompleter. */ public void addJournalListToAutoCompleter() { if (autoCompleters.containsKey("journal")) { AbstractAutoCompleter ac = autoCompleters.get("journal"); Set<String> journals = Globals.journalAbbrev.getJournals().keySet(); for (String journal : journals) ac.addWordToIndex(journal); } }
/** * For all fields with both autocompletion and content selector, add content selector * values to the autocompleter list: */ public void addContentSelectorValuesToAutoCompleters() { for (String field : autoCompleters.keySet()) { AbstractAutoCompleter ac = autoCompleters.get(field); if (metaData.getData(Globals.SELECTOR_META_PREFIX + field) != null) { Vector<String> items = metaData.getData(Globals.SELECTOR_META_PREFIX + field); if (items != null) { Iterator<String> i = items.iterator(); while (i.hasNext()) ac.addWordToIndex(i.next()); } } } }
Clone fragments detected by clone detection tool
File path: /jabref-2.10/src/java/net/sf/jabref/BasePanel.java File path: /jabref-2.10/src/java/net/sf/jabref/BasePanel.java
Method name: void addJournalListToAutoCompleter() Method name: void addContentSelectorValuesToAutoCompleters()
Number of AST nodes: 2 Number of AST nodes: 2
1
/**
1
/**
2
     * If an autocompleter exists for the "journal" field, add all
2
     * For all fields with both autocompletion and content selector, add content selector
3
     * journal names in the journal abbreviation list to this autocompleter.
3
     * values to the autocompleter list:
4
     */
4
     */
5
    public void addJournalListToAutoCompleter() {
5
    public void addContentSelectorValuesToAutoCompleters() {
6
        if (autoCompleters.containsKey("journal")) {
6
        for (String field : autoCompleters.keySet()) {
7
            AbstractAutoCompleter ac = autoCompleters.get("journal");
7
            AbstractAutoCompleter ac = autoCompleters.get(field);
8
            Set<String> journals = Globals.journalAbbrev.getJournals().keySet();
8
            if (metaData.getData(Globals.SELECTOR_META_PREFIX + field) != null) {
9
            for (String journal : journals)
9
                Vector<String> items = metaData.getData(Globals.SELECTOR_META_PREFIX + field);
10
                ac.addWordToIndex(journal);
10
                if (items != null) {
11
        }
11
                    Iterator<String> i = items.iterator();
12
12
                    while (i.hasNext())
13
13
                        ac.addWordToIndex(i.next());
14
    }
14
                }
15
            }
16
        }
17
    }
  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)0.0
    Similarity Score0.500
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    4
    for (String journal : journals)
    4
    for (String journal : journals)
    7
    while (i.hasNext())
    Differences
    Expression1Expression2Difference
    java.util.Setjava.util.VectorVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.util.Set<java.lang.String> of variable journals does not match with type java.util.Vector<java.lang.String> of variable items
    • Make classes java.util.Set and java.util.Vector extend a common superclass
    7
    while (i.hasNext())
    5
    ac.addWordToIndex(journal);
    5
    ac.addWordToIndex(journal);
    8
    ac.addWordToIndex(i.next());
    Differences
    Expression1Expression2Difference
    journali.next()TYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression journal cannot be parameterized, because it has dependencies to/from statements that will be extracted
    8
    ac.addWordToIndex(i.next());
    Precondition Violations (2)
    Row Violation
    1Type java.util.Set<java.lang.String> of variable journals does not match with type java.util.Vector<java.lang.String> of variable items
    2Expression journal cannot be parameterized, because it has dependencies to/from statements that will be extracted