int old = getPollInterval(); setInteger(POLLING_INTERVAL_PATH, null, interval); if (old != interval) { for (Iterator it = observers.iterator(); it.hasNext();) ((OptionsObserver) it.next()).pollingIntervalChanged(interval); }
boolean old = isPollingEnabled(); setBoolean(POLLING_ENABLED_PATH, null, poll); if (old != poll) { for (Iterator it = observers.iterator(); it.hasNext();) ((OptionsObserver) it.next()).pollingStateChanged(poll); }
Clone fragments detected by clone detection tool
File path: /columba-1.4-src/core/src/main/java/org/columba/core/scripting/config/Options.java File path: /columba-1.4-src/core/src/main/java/org/columba/core/scripting/config/Options.java
Method name: void setPollInterval(int) Method name: void setPollingEnabled(boolean)
Number of AST nodes: 5 Number of AST nodes: 5
1
int old = getPollInterval();
1
boolean old = isPollingEnabled();
2
        setInteger(POLLING_INTERVAL_PATH, null, interval);
2
        setBoolean(POLLING_ENABLED_PATH, null, poll);
3
        if (old != interval)
3
        if (old != poll)
4
        {
4
        {
5
            for (Iterator it = observers.iterator(); it.hasNext();)
5
            for (Iterator it = observers.iterator(); it.hasNext();)
6
                ((OptionsObserver) it.next()).pollingIntervalChanged(interval);
6
                ((OptionsObserver) it.next()).pollingStateChanged(poll);
7
        }
7
        }
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.3
Clones locationClones are declared in the same class
Number of node comparisons9
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements2
    Number of unmapped statements in the first code fragment3
    Number of unmapped statements in the second code fragment3
    Time elapsed for statement mapping (ms)12.6
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
                                                                        
    1
    boolean old = isPollingEnabled();
    1
    int old = getPollInterval();
                                                              
                                                                                                
    2
    setBoolean(POLLING_ENABLED_PATH, null, poll);
    2
    setInteger(POLLING_INTERVAL_PATH, null, interval);
                                                                                                          
    3
    if (old != interval)
    3
    if (old != interval)
    3
    if (old != poll)
    Differences
    Expression1Expression2Difference
    intbooleanVARIABLE_TYPE_MISMATCH
    intervalpollVARIABLE_NAME_MISMATCH
    intbooleanVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type int of variable old does not match with type boolean of variable old
    Type int of variable interval does not match with type boolean of variable poll
    3
    if (old != poll)
    4
    for (Iterator it = observers.iterator(); it.hasNext(); )
    4
    for (Iterator it = observers.iterator(); it.hasNext(); )
                                                                                                                        
    5
    ((OptionsObserver)it.next()).pollingStateChanged(poll);
    Preondition Violations
    Unmatched statement ((OptionsObserver)it.next()).pollingStateChanged(poll); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    5
    ((OptionsObserver)it.next()).pollingStateChanged(poll);
    5
    ((OptionsObserver)it.next()).pollingIntervalChanged(interval);
    5
    ((OptionsObserver)it.next()).pollingIntervalChanged(interval);
    Preondition Violations
    Unmatched statement ((OptionsObserver)it.next()).pollingIntervalChanged(interval); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                                                                      
    Precondition Violations (4)
    Row Violation
    1Type int of variable old does not match with type boolean of variable old
    2Type int of variable interval does not match with type boolean of variable poll
    3Unmatched statement ((OptionsObserver)it.next()).pollingStateChanged(poll); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4Unmatched statement ((OptionsObserver)it.next()).pollingIntervalChanged(interval); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted