if (list == null) { return pre; } int result = 127; int size = list.size(); result = HashUtilities.hashCode(result, size); // for efficiency, we just use the first, last and middle items to // compute a hashCode... if (size > 0) { result = HashUtilities.hashCode(result, list.getBoolean(0)); if (size > 1) { result = HashUtilities.hashCode(result, list.getBoolean(size - 1)); if (size > 2) { result = HashUtilities.hashCode(result, list.getBoolean(size / 2)); } } } return 37 * pre + result;
if (list == null) { return pre; } int result = 127; int size = list.size(); result = HashUtilities.hashCode(result, size); // for efficiency, we just use the first, last and middle items to // compute a hashCode... if (size > 0) { result = HashUtilities.hashCode(result, list.getStroke(0)); if (size > 1) { result = HashUtilities.hashCode(result, list.getStroke(size - 1)); if (size > 2) { result = HashUtilities.hashCode(result, list.getStroke(size / 2)); } } } return 37 * pre + result;
Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/chart/HashUtilities.java File path: /jfreechart-1.0.10/src/org/jfree/chart/HashUtilities.java
Method name: int hashCode(int, BooleanList) Method name: int hashCode(int, StrokeList)
Number of AST nodes: 12 Number of AST nodes: 12
1
if (list == null) {
1
if (list == null) {
2
            return pre;
2
            return pre;
3
        }
3
        }
4
        int result = 127;
4
        int result = 127;
5
        int size = list.size();
5
        int size = list.size();
6
        result = HashUtilities.hashCode(result, size);
6
        result = HashUtilities.hashCode(result, size);
7
        
7
        
8
        // for efficiency, we just use the first, last and middle items to
8
        // for efficiency, we just use the first, last and middle items to
9
        // compute a hashCode...
9
        // compute a hashCode...
10
        if (size > 0) {
10
        if (size > 0) {
11
            result = HashUtilities.hashCode(result, list.getBoolean(0));
11
            result = HashUtilities.hashCode(result, list.getStroke(0));
12
            if (size > 1) {
12
            if (size > 1) {
13
                result = HashUtilities.hashCode(result, 
13
                result = HashUtilities.hashCode(result, 
14
                        list.getBoolean(size - 1));
14
                        list.getStroke(size - 1));
15
                if (size > 2) {
15
                if (size > 2) {
16
                    result = HashUtilities.hashCode(result, 
16
                    result = HashUtilities.hashCode(result, 
17
                            list.getBoolean(size / 2));
17
                            list.getStroke(size / 2));
18
                }
18
                }
19
            }
19
            }
20
        }
20
        }
21
        return 37 * pre + result;
21
        return 37 * pre + result;
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.2
Clones locationClones are declared in the same class
Number of node comparisons32
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements12
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)4.0
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    if (list == null)
    1
    if (list == null)
    1
    if (list == null)
    Differences
    Expression1Expression2Difference
    org.jfree.util.BooleanListorg.jfree.util.StrokeListSUBCLASS_TYPE_MISMATCH
    1
    if (list == null)
    2
    return pre;
    2
    return pre;
    3
    int result = 127;
    3
    int result = 127;
    4
    int size = list.size();
    4
    int size = list.size();
    4
    int size = list.size();
    Differences
    Expression1Expression2Difference
    org.jfree.util.BooleanListorg.jfree.util.StrokeListSUBCLASS_TYPE_MISMATCH
    4
    int size = list.size();
    5
    result = HashUtilities.hashCode(result, size);
    5
    result = HashUtilities.hashCode(result, size);
    6
    if (size > 0)
    6
    if (size > 0)
    7
    result = HashUtilities.hashCode(result, list.getBoolean(0));
    7
    result = HashUtilities.hashCode(result, list.getBoolean(0));
    7
    result = HashUtilities.hashCode(result, list.getStroke(0));
    Differences
    Expression1Expression2Difference
    getBooleangetStrokeMETHOD_INVOCATION_NAME_MISMATCH
    java.lang.Booleanjava.awt.StrokeVARIABLE_TYPE_MISMATCH
    org.jfree.util.BooleanListorg.jfree.util.StrokeListSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Type java.lang.Boolean of variable list.getBoolean(0) does not match with type java.awt.Stroke of variable list.getStroke(0)
    • Make classes java.lang.Boolean and java.awt.Stroke extend a common superclass
    Expression list cannot be unified with expression list , because common superclass org.jfree.util.AbstractObjectList does not declare member(s) public java.lang.Boolean getBoolean(int) , public java.awt.Stroke getStroke(int)
    7
    result = HashUtilities.hashCode(result, list.getStroke(0));
    8
    if (size > 1)
    8
    if (size > 1)
    9
    result = HashUtilities.hashCode(result, list.getBoolean(size - 1));
    9
    result = HashUtilities.hashCode(result, list.getBoolean(size - 1));
    9
    result = HashUtilities.hashCode(result, list.getStroke(size - 1));
    Differences
    Expression1Expression2Difference
    getBooleangetStrokeMETHOD_INVOCATION_NAME_MISMATCH
    java.lang.Booleanjava.awt.StrokeVARIABLE_TYPE_MISMATCH
    org.jfree.util.BooleanListorg.jfree.util.StrokeListSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression list.getBoolean(size - 1) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression list.getStroke(size - 1) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Type java.lang.Boolean of variable list.getBoolean(size - 1) does not match with type java.awt.Stroke of variable list.getStroke(size - 1)
    • Make classes java.lang.Boolean and java.awt.Stroke extend a common superclass
    Expression list cannot be unified with expression list , because common superclass org.jfree.util.AbstractObjectList does not declare member(s) public java.lang.Boolean getBoolean(int) , public java.awt.Stroke getStroke(int)
    9
    result = HashUtilities.hashCode(result, list.getStroke(size - 1));
    10
    if (size > 2)
    10
    if (size > 2)
    11
    result = HashUtilities.hashCode(result, list.getBoolean(size / 2));
    11
    result = HashUtilities.hashCode(result, list.getBoolean(size / 2));
    11
    result = HashUtilities.hashCode(result, list.getStroke(size / 2));
    Differences
    Expression1Expression2Difference
    getBooleangetStrokeMETHOD_INVOCATION_NAME_MISMATCH
    java.lang.Booleanjava.awt.StrokeVARIABLE_TYPE_MISMATCH
    org.jfree.util.BooleanListorg.jfree.util.StrokeListSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression list.getBoolean(size / 2) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression list.getStroke(size / 2) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Type java.lang.Boolean of variable list.getBoolean(size / 2) does not match with type java.awt.Stroke of variable list.getStroke(size / 2)
    • Make classes java.lang.Boolean and java.awt.Stroke extend a common superclass
    Expression list cannot be unified with expression list , because common superclass org.jfree.util.AbstractObjectList does not declare member(s) public java.lang.Boolean getBoolean(int) , public java.awt.Stroke getStroke(int)
    11
    result = HashUtilities.hashCode(result, list.getStroke(size / 2));
    12
    return 37 * pre + result;
    12
    return 37 * pre + result;
    Precondition Violations (10)
    Row Violation
    1Type java.lang.Boolean of variable list.getBoolean(0) does not match with type java.awt.Stroke of variable list.getStroke(0)
    2Expression list cannot be unified with expression list , because common superclass org.jfree.util.AbstractObjectList does not declare member(s) public java.lang.Boolean getBoolean(int) , public java.awt.Stroke getStroke(int)
    3Expression list.getBoolean(size - 1) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Expression list.getStroke(size - 1) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5Type java.lang.Boolean of variable list.getBoolean(size - 1) does not match with type java.awt.Stroke of variable list.getStroke(size - 1)
    6Expression list cannot be unified with expression list , because common superclass org.jfree.util.AbstractObjectList does not declare member(s) public java.lang.Boolean getBoolean(int) , public java.awt.Stroke getStroke(int)
    7Expression list.getBoolean(size / 2) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    8Expression list.getStroke(size / 2) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    9Type java.lang.Boolean of variable list.getBoolean(size / 2) does not match with type java.awt.Stroke of variable list.getStroke(size / 2)
    10Expression list cannot be unified with expression list , because common superclass org.jfree.util.AbstractObjectList does not declare member(s) public java.lang.Boolean getBoolean(int) , public java.awt.Stroke getStroke(int)