if (decLength > 0) { if (decZeroes > 0) { buf.fill('0',decZeroes); precision -= decZeroes; } if (decDigits > 0) { buf.append(digits,intDigits,decDigits); precision -= decDigits; } if ((flags & FLAG_SHARP) != 0 && precision > 0) { buf.fill('0',precision); } }
if (precision > 0) { if (decZeroes > 0) { buf.fill('0',decZeroes); precision -= decZeroes; } if (decDigits > 0) { buf.append(digits,intDigits,decDigits); precision -= decDigits; } // fill up the rest with zeroes if (precision > 0) { buf.fill('0',precision); } }
Clone fragments detected by clone detection tool
File path: /jruby-1.4.0/src/org/jruby/util/Sprintf.java File path: /jruby-1.4.0/src/org/jruby/util/Sprintf.java
Method name: boolean rubySprintfToBuffer(ByteList, CharSequence, Args, boolean) Method name: boolean rubySprintfToBuffer(ByteList, CharSequence, Args, boolean)
Number of AST nodes: 9 Number of AST nodes: 9
1
if (decLength > 0) {
1
if (precision > 0) {
2
                                if (decZeroes > 0) {
2
                            if (decZeroes > 0) {
3
                                    buf.fill('0',decZeroes);
3
                                buf.fill('0',decZeroes);
4
                                    precision -= decZeroes;
4
                                precision -= decZeroes;
5
                                }
5
                            
6
    
6
}
7
                            if (decDigits > 0) {
7
                            if (decDigits > 0) {
8
                                    buf.append(digits,intDigits,decDigits);
8
                                buf.append(digits,intDigits,decDigits);
9
                                    precision -= decDigits;
9
                                precision -= decDigits;
10
                                }
10
                            }
11
                                if ((flags & FLAG_SHARP) != 0 && 
11
                            // fill up the rest with zeroes
12
precision > 0) {
12
                            if (precision > 0) {
13
                                    buf.fill('0',precision);
13
                                buf.fill('0',precision);
14
                                }
14
                            
15
    
15
}
16
                        }
16
                        }
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.8
Clones locationClones are in the same method
Number of node comparisons42
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements7
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)15.9
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    585
    if (decLength > 0)
    585
    if (decLength > 0)
    642
    if (precision > 0)
    Differences
    Expression1Expression2Difference
    decLengthprecisionVARIABLE_NAME_MISMATCH
    Preondition Violations
    Expression precision cannot be parameterized, because it has dependencies to/from statements that will be extracted
    642
    if (precision > 0)
    586
    if (decZeroes > 0)
    643
    if (decZeroes > 0)
    587
    buf.fill('0', decZeroes);
    644
    buf.fill('0', decZeroes);
    588
    precision -= decZeroes;
    645
    precision -= decZeroes;
    589
    if (decDigits > 0)
    646
    if (decDigits > 0)
    590
    buf.append(digits, intDigits, decDigits);
    647
    buf.append(digits, intDigits, decDigits);
    591
    precision -= decDigits;
    648
    precision -= decDigits;
    Precondition Violations (1)
    Row Violation
    1Expression precision cannot be parameterized, because it has dependencies to/from statements that will be extracted