if (!isVisible()) { return new AxisState(cursor); } if (isAxisLineVisible()) { drawAxisLine(g2, cursor, dataArea, edge); } // draw the category labels and axis label AxisState state = new AxisState(cursor); state = drawCategoryLabels(g2, plotArea, dataArea, edge, state, plotState); state = drawLabel(getLabel(), g2, plotArea, dataArea, edge, state); return state;
AxisState state = null; // if the axis is not visible, don't draw it... if (!isVisible()) { state = new AxisState(cursor); // even though the axis is not visible, we need ticks for the // gridlines... List ticks = refreshTicks(g2, state, dataArea, edge); state.setTicks(ticks); return state; } // draw the tick marks and labels... state = drawTickMarksAndLabels(g2, cursor, plotArea, dataArea, edge); // // draw the marker band (if there is one)... // if (getMarkerBand() != null) { // if (edge == RectangleEdge.BOTTOM) { // cursor = cursor - getMarkerBand().getHeight(g2); // } // getMarkerBand().draw(g2, plotArea, dataArea, 0, cursor); // } // draw the axis label... state = drawLabel(getLabel(), g2, plotArea, dataArea, edge, state); return state;
Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/chart/axis/CategoryAxis.java File path: /jfreechart-1.0.10/src/org/jfree/chart/axis/NumberAxis.java
Method name: AxisState draw(Graphics2D, double, Rectangle2D, Rectangle2D, RectangleEdge, PlotRenderingInfo) Method name: AxisState draw(Graphics2D, double, Rectangle2D, Rectangle2D, RectangleEdge, PlotRenderingInfo)
Number of AST nodes: 8 Number of AST nodes: 9
1
AxisState state = null;
2
        // if the axis is not visible, don't draw it...
1
if (!isVisible()) {
3
        if (!isVisible()) {
2
            return new AxisState(cursor);
4
            state = new AxisState(cursor);
3
        }
5
        
4
        if (isAxisLineVisible()) {
5
            drawAxisLine(g2, cursor, dataArea, edge)
6
    // even though the axis is not visible, we need ticks for the
7
            // gridlines...
8
            List ticks = refreshTicks(g2, state, dataArea, edge);
9
            state.setTicks(ticks);
6
;
10
            return state;
7
        }
11
        }
8
        // draw the category labels and axis label
12
        // draw the 
9
        AxisState state = new AxisState(cursor
13
tick marks and labels...
14
        state = drawTickMarksAndLabels(g2, cursor, plotArea, dataArea, edge);
15
//        // draw the marker band (if there is one)...
16
//        if (getMarkerBand() != null) {
17
//            if (edge == RectangleEdge.BOTTOM) {
10
);
18
//                cursor = cursor - getMarkerBand().getHeight(g2);
11
        state = drawCategoryLabels
19
//            }
12
(g2, plotArea, dataArea, edge, state,
20
//            getMarkerBand().draw(g2, plotArea, dataArea, 
21
0, cursor);
13
        
22
//        }
14
        plotState);
23
        // draw the axis label...
15
        state = drawLabel(getLabel(), g2, plotArea, dataArea, edge, state);
24
        state = drawLabel(getLabel(), g2, plotArea, dataArea, edge, state);
16
        return state;
25
        return state;
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 in different classes having the same super class
Number of node comparisons24
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements6
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment3
    Time elapsed for statement mapping (ms)39.6
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    1
    if (!isVisible())
    2
    if (!isVisible())
                                                                  
    3
    state = new AxisState(cursor);
    Preondition Violations
    Unmatched statement state=new AxisState(cursor); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3
    state = new AxisState(cursor);
                                                                                                          
    4
    List ticks = refreshTicks(g2, state, dataArea, edge);
    Preondition Violations
    Unmatched statement List ticks=refreshTicks(g2,state,dataArea,edge); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    Unmatched statement List ticks=refreshTicks(g2,state,dataArea,edge); 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
    4
    List ticks = refreshTicks(g2, state, dataArea, edge);
                                                      
    5
    state.setTicks(ticks);
    Preondition Violations
    Unmatched statement state.setTicks(ticks); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    5
    state.setTicks(ticks);
    2
    return new AxisState(cursor);
    2
    return new AxisState(cursor);
    6
    return state;
    Differences
    Expression1Expression2Difference
    new AxisState(cursor)stateTYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression state cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6
    return state;
    5
    AxisState state = new AxisState(cursor);
    5
    AxisState state = new AxisState(cursor);
    1
    AxisState state = null;
    Differences
    Expression1Expression2Difference
    new AxisState(cursor)nullTYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression new AxisState(cursor) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    1
    AxisState state = null;
    6
    state = drawCategoryLabels(g2, plotArea, dataArea, edge, state, plotState);
    6
    state = drawCategoryLabels(g2, plotArea, dataArea, edge, state, plotState);
    7
    state = drawTickMarksAndLabels(g2, cursor, plotArea, dataArea, edge);
    Differences
    Expression1Expression2Difference
    drawCategoryLabelsdrawTickMarksAndLabelsMETHOD_INVOCATION_NAME_MISMATCH
    drawCategoryLabels(g2,plotArea,dataArea,edge,state,plotState)drawTickMarksAndLabels(g2,cursor,plotArea,dataArea,edge)ARGUMENT_NUMBER_MISMATCH
    Preondition Violations
    Expression drawCategoryLabels(g2,plotArea,dataArea,edge,state,plotState) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression drawTickMarksAndLabels(g2,cursor,plotArea,dataArea,edge) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression drawCategoryLabels(g2,plotArea,dataArea,edge,state,plotState) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression drawTickMarksAndLabels(g2,cursor,plotArea,dataArea,edge) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    7
    state = drawTickMarksAndLabels(g2, cursor, plotArea, dataArea, edge);
    7
    state = drawLabel(getLabel(), g2, plotArea, dataArea, edge, state);
    8
    state = drawLabel(getLabel(), g2, plotArea, dataArea, edge, state);
    8
    return state;
    9
    return state;
    Precondition Violations (11)
    Row Violation
    1Unmatched statement state=new AxisState(cursor); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    2Unmatched statement List ticks=refreshTicks(g2,state,dataArea,edge); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    3Unmatched statement List ticks=refreshTicks(g2,state,dataArea,edge); 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
    4Unmatched statement state.setTicks(ticks); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    5Expression state cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6Expression new AxisState(cursor) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    7Expression drawCategoryLabels(g2,plotArea,dataArea,edge,state,plotState) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    8Expression drawTickMarksAndLabels(g2,cursor,plotArea,dataArea,edge) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    9Expression drawCategoryLabels(g2,plotArea,dataArea,edge,state,plotState) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    10Expression drawTickMarksAndLabels(g2,cursor,plotArea,dataArea,edge) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    11Clone fragment #1 returns variables , while Clone fragment #2 returns variables state