if (this.stroke != null) { return this.stroke; } // otherwise look up the paint table Stroke result = getSeriesStroke(series); if (result == null && this.autoPopulateSeriesStroke) { DrawingSupplier supplier = getDrawingSupplier(); if (supplier != null) { result = supplier.getNextStroke(); setSeriesStroke(series, result, false); } } if (result == null) { result = this.baseStroke; } return result;
if (this.shape != null) { return this.shape; } // otherwise look up the shape list Shape result = getSeriesShape(series); if (result == null && this.autoPopulateSeriesShape) { DrawingSupplier supplier = getDrawingSupplier(); if (supplier != null) { result = supplier.getNextShape(); setSeriesShape(series, result, false); } } if (result == null) { result = this.baseShape; } return result;
Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/chart/renderer/AbstractRenderer.java File path: /jfreechart-1.0.10/src/org/jfree/chart/renderer/AbstractRenderer.java
Method name: Stroke lookupSeriesStroke(int) Method name: Shape lookupSeriesShape(int)
Number of AST nodes: 11 Number of AST nodes: 11
1
if (this.stroke != null) {
1
if (this.shape != null) {
2
            return this.stroke;
2
            return this.shape;
3
        }
3
        }
4
        // otherwise look up the paint table
4
        // otherwise look up the shape list
5
        Stroke result = getSeriesStroke(series);
5
        Shape result = getSeriesShape(series);
6
        if (result == null && this.autoPopulateSeriesStroke) {
6
        if (result == null && this.autoPopulateSeriesShape) {
7
            DrawingSupplier supplier = getDrawingSupplier();
7
            DrawingSupplier supplier = getDrawingSupplier();
8
            if (supplier != null) {
8
            if (supplier != null) {
9
                result = supplier.getNextStroke();
9
                result = supplier.getNextShape();
10
                setSeriesStroke(series, result, false);
10
                setSeriesShape(series, result, false);
11
            }
11
            }
12
        }
12
        }
13
        if (result == null) {
13
        if (result == null) {
14
            result = this.baseStroke;
14
            result = this.baseShape;
15
        }
15
        }
16
        return result;
16
        return 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.6
Clones locationClones are declared in the same class
Number of node comparisons27
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements6
    Number of unmapped statements in the first code fragment5
    Number of unmapped statements in the second code fragment5
    Time elapsed for statement mapping (ms)4.0
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    if (this.stroke != null)
    1
    if (this.stroke != null)
    1
    if (this.shape != null)
    Differences
    Expression1Expression2Difference
    strokeshapeVARIABLE_NAME_MISMATCH
    java.awt.Strokejava.awt.ShapeVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.awt.Stroke of variable this.stroke does not match with type java.awt.Shape of variable this.shape
    • Make classes java.awt.Stroke and java.awt.Shape extend a common superclass
    1
    if (this.shape != null)
                                              
    2
    return this.shape;
    Preondition Violations
    Unmatched statement return this.shape; cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    Unmatched return this.shape;
    2
    return this.shape;
    2
    return this.stroke;
    2
    return this.stroke;
    Preondition Violations
    Unmatched statement return this.stroke; cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    Unmatched return this.stroke;
                                                
                                                                                  
    3
    Shape result = getSeriesShape(series);
    3
    Stroke result = getSeriesStroke(series);
                                                                                      
    4
    if (result == null && this.autoPopulateSeriesStroke)
    4
    if (result == null && this.autoPopulateSeriesStroke)
    4
    if (result == null && this.autoPopulateSeriesShape)
    Differences
    Expression1Expression2Difference
    java.awt.Strokejava.awt.ShapeVARIABLE_TYPE_MISMATCH
    autoPopulateSeriesStrokeautoPopulateSeriesShapeVARIABLE_NAME_MISMATCH
    Preondition Violations
    Type java.awt.Stroke of variable result does not match with type java.awt.Shape of variable result
    • Make classes java.awt.Stroke and java.awt.Shape extend a common superclass
    4
    if (result == null && this.autoPopulateSeriesShape)
    5
    DrawingSupplier supplier = getDrawingSupplier();
    5
    DrawingSupplier supplier = getDrawingSupplier();
    6
    if (supplier != null)
    6
    if (supplier != null)
                                                                        
    7
    result = supplier.getNextShape();
    Preondition Violations
    Unmatched statement result=supplier.getNextShape(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    7
    result = supplier.getNextShape();
    7
    result = supplier.getNextStroke();
    7
    result = supplier.getNextStroke();
    Preondition Violations
    Unmatched statement result=supplier.getNextStroke(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                          
    8
    setSeriesStroke(series, result, false);
    8
    setSeriesStroke(series, result, false);
    8
    setSeriesShape(series, result, false);
    Differences
    Expression1Expression2Difference
    java.awt.Strokejava.awt.ShapeVARIABLE_TYPE_MISMATCH
    setSeriesStrokesetSeriesShapeMETHOD_INVOCATION_NAME_MISMATCH
    Preondition Violations
    Type java.awt.Stroke of variable result does not match with type java.awt.Shape of variable result
    • Make classes java.awt.Stroke and java.awt.Shape extend a common superclass
    Expression setSeriesStroke(series,result,false) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression setSeriesShape(series,result,false) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression setSeriesStroke(series,result,false) is a void method call, and thus it cannot be parameterized
    Expression setSeriesShape(series,result,false) is a void method call, and thus it cannot be parameterized
    8
    setSeriesShape(series, result, false);
    9
    if (result == null)
    9
    if (result == null)
    9
    if (result == null)
    Differences
    Expression1Expression2Difference
    java.awt.Strokejava.awt.ShapeVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.awt.Stroke of variable result does not match with type java.awt.Shape of variable result
    • Make classes java.awt.Stroke and java.awt.Shape extend a common superclass
    9
    if (result == null)
                                                        
    10
    result = this.baseShape;
    Preondition Violations
    Unmatched statement result=this.baseShape; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    10
    result = this.baseShape;
    10
    result = this.baseStroke;
    10
    result = this.baseStroke;
    Preondition Violations
    Unmatched statement result=this.baseStroke; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                          
                                        
    11
    return result;
    Preondition Violations
    Unmatched return result;
    11
    return result;
    11
    return result;
    11
    return result;
    Preondition Violations
    Unmatched return result;
                                        
    Precondition Violations (18)
    Row Violation
    1Type java.awt.Stroke of variable this.stroke does not match with type java.awt.Shape of variable this.shape
    2Unmatched statement return this.shape; cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    3Unmatched return this.shape;
    4Unmatched statement return this.stroke; cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    5Unmatched return this.stroke;
    6Type java.awt.Stroke of variable result does not match with type java.awt.Shape of variable result
    7Unmatched statement result=supplier.getNextShape(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    8Unmatched statement result=supplier.getNextStroke(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    9Type java.awt.Stroke of variable result does not match with type java.awt.Shape of variable result
    10Expression setSeriesStroke(series,result,false) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    11Expression setSeriesShape(series,result,false) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    12Expression setSeriesStroke(series,result,false) is a void method call, and thus it cannot be parameterized
    13Expression setSeriesShape(series,result,false) is a void method call, and thus it cannot be parameterized
    14Type java.awt.Stroke of variable result does not match with type java.awt.Shape of variable result
    15Unmatched statement result=this.baseShape; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    16Unmatched statement result=this.baseStroke; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    17Unmatched return result;
    18Unmatched return result;