stream.defaultWriteObject(); stream.writeInt(this.store.size()); Set keys = this.store.keySet(); Iterator iterator = keys.iterator(); while (iterator.hasNext()) { Comparable key = (Comparable) iterator.next(); stream.writeObject(key); Paint paint = getPaint(key); SerialUtilities.writePaint(paint, stream); }
stream.defaultWriteObject(); stream.writeInt(this.store.size()); Set keys = this.store.keySet(); Iterator iterator = keys.iterator(); while (iterator.hasNext()) { Comparable key = (Comparable) iterator.next(); stream.writeObject(key); Stroke stroke = getStroke(key); SerialUtilities.writeStroke(stroke, stream); }
Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/chart/PaintMap.java File path: /jfreechart-1.0.10/src/org/jfree/chart/StrokeMap.java
Method name: void writeObject(ObjectOutputStream) Method name: void writeObject(ObjectOutputStream)
Number of AST nodes: 9 Number of AST nodes: 9
1
stream.defaultWriteObject();
1
stream.defaultWriteObject();
2
        stream.writeInt(this.store.size());
2
        stream.writeInt(this.store.size());
3
        Set keys = this.store.keySet();
3
        Set keys = this.store.keySet();
4
        Iterator iterator = keys.iterator();
4
        Iterator iterator = keys.iterator();
5
        while (iterator.hasNext()) {
5
        while (iterator.hasNext()) {
6
            Comparable key = (Comparable) iterator.next();
6
            Comparable key = (Comparable) iterator.next();
7
            stream.writeObject(key);
7
            stream.writeObject(key);
8
            Paint paint = getPaint(key);
8
            Stroke stroke = getStroke(key);
9
            SerialUtilities.writePaint(paint, stream);
9
            SerialUtilities.writeStroke(stroke, stream);
10
        }
10
        }
Summary
Number of common nesting structure subtrees1
Number of refactorable cases1
Number of non-refactorable cases0
Time elapsed for finding largest common nesting structure subtrees (ms)0.1
Clones locationClones are in different classes
Number of node comparisons33
  1. {Refactorable}
    Mapping Summary
    Number of mapped statements7
    Number of unmapped statements in the first code fragment2
    Number of unmapped statements in the second code fragment2
    Time elapsed for statement mapping (ms)26.6
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    stream.defaultWriteObject();
    1
    stream.defaultWriteObject();
    2
    stream.writeInt(this.store.size());
    2
    stream.writeInt(this.store.size());
    3
    Set keys = this.store.keySet();
    3
    Set keys = this.store.keySet();
    4
    Iterator iterator = keys.iterator();
    4
    Iterator iterator = keys.iterator();
    5
    while (iterator.hasNext())
    5
    while (iterator.hasNext())
    6
    Comparable key = (Comparable)iterator.next();
    6
    Comparable key = (Comparable)iterator.next();
    7
    stream.writeObject(key);
    7
    stream.writeObject(key);
                                                                    
    8
    Stroke stroke = getStroke(key);
    Preondition Violations
    Unmatched statement Stroke stroke=getStroke(key); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    Unmatched statement Stroke stroke=getStroke(key); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted
    8
    Stroke stroke = getStroke(key);
    8
    Paint paint = getPaint(key);
    8
    Paint paint = getPaint(key);
    Preondition Violations
    Unmatched statement Paint paint=getPaint(key); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    Unmatched statement Paint paint=getPaint(key); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted
                                                              
                                                                                                
    9
    SerialUtilities.writeStroke(stroke, stream);
    Preondition Violations
    Unmatched statement SerialUtilities.writeStroke(stroke,stream); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    Unmatched statement SerialUtilities.writeStroke(stroke,stream); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted
    9
    SerialUtilities.writeStroke(stroke, stream);
    9
    SerialUtilities.writePaint(paint, stream);
    9
    SerialUtilities.writePaint(paint, stream);
    Preondition Violations
    Unmatched statement SerialUtilities.writePaint(paint,stream); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    Unmatched statement SerialUtilities.writePaint(paint,stream); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted
                                                                                            
    Precondition Violations (8)
    Row Violation
    1Unmatched statement Stroke stroke=getStroke(key); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    2Unmatched statement Stroke stroke=getStroke(key); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted
    3Unmatched statement Paint paint=getPaint(key); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4Unmatched statement Paint paint=getPaint(key); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted
    5Unmatched statement SerialUtilities.writeStroke(stroke,stream); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    6Unmatched statement SerialUtilities.writeStroke(stroke,stream); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted
    7Unmatched statement SerialUtilities.writePaint(paint,stream); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    8Unmatched statement SerialUtilities.writePaint(paint,stream); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted