if (info != null) { info.setPlotArea(area); } // adjust the drawing area for plot insets (if any)... RectangleInsets insets = getInsets(); insets.trim(area); // calculate the data area... AxisSpace space = calculateAxisSpace(g2, area); Rectangle2D dataArea = space.shrink(area, null); // set the width and height of non-shared axis of all sub-plots setFixedDomainAxisSpaceForSubplots(space); // draw the shared axis ValueAxis axis = getRangeAxis(); RectangleEdge rangeEdge = getRangeAxisEdge(); double cursor = RectangleEdge.coordinate(dataArea, rangeEdge); AxisState state = axis.draw(g2, cursor, area, dataArea, rangeEdge, info); if (parentState == null) { parentState = new PlotState(); } parentState.getSharedAxisStates().put(axis, state); // draw all the charts for (int i = 0; i < this.subplots.size(); i++) { CategoryPlot plot = (CategoryPlot) this.subplots.get(i); PlotRenderingInfo subplotInfo = null; if (info != null) { subplotInfo = new PlotRenderingInfo(info.getOwner()); info.addSubplotInfo(subplotInfo); } plot.draw(g2, this.subplotArea[i], null, parentState, subplotInfo); } if (info != null) { info.setDataArea(dataArea); }
if (info != null) { info.setPlotArea(area); } // adjust the drawing area for plot insets (if any)... RectangleInsets insets = getInsets(); insets.trim(area); AxisSpace space = calculateAxisSpace(g2, area); Rectangle2D dataArea = space.shrink(area, null); //this.axisOffset.trim(dataArea); // set the width and height of non-shared axis of all sub-plots setFixedDomainAxisSpaceForSubplots(space); // draw the shared axis ValueAxis axis = getRangeAxis(); RectangleEdge edge = getRangeAxisEdge(); double cursor = RectangleEdge.coordinate(dataArea, edge); AxisState axisState = axis.draw(g2, cursor, area, dataArea, edge, info); if (parentState == null) { parentState = new PlotState(); } parentState.getSharedAxisStates().put(axis, axisState); // draw all the charts for (int i = 0; i < this.subplots.size(); i++) { XYPlot plot = (XYPlot) this.subplots.get(i); PlotRenderingInfo subplotInfo = null; if (info != null) { subplotInfo = new PlotRenderingInfo(info.getOwner()); info.addSubplotInfo(subplotInfo); } plot.draw(g2, this.subplotAreas[i], anchor, parentState, subplotInfo); } if (info != null) { info.setDataArea(dataArea); }
Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/chart/plot/CombinedRangeCategoryPlot.java File path: /jfreechart-1.0.10/src/org/jfree/chart/plot/CombinedRangeXYPlot.java
Method name: void draw(Graphics2D, Rectangle2D, Point2D, PlotState, PlotRenderingInfo) Method name: void draw(Graphics2D, Rectangle2D, Point2D, PlotState, PlotRenderingInfo)
Number of AST nodes: 23 Number of AST nodes: 23
1
if (info != null) {
1
if (info != null) {
2
            info.setPlotArea(area);
2
            info.setPlotArea(area);
3
        }
3
        }
4
        // adjust the drawing area for plot insets (if any)...
4
        // adjust the drawing area for plot insets (if any)...
5
        RectangleInsets insets = getInsets();
5
        RectangleInsets insets = getInsets();
6
        insets.trim(area);
6
        insets.trim(area);
7
        // calculate the data area...
8
        AxisSpace space = calculateAxisSpace(g2, area);
7
        AxisSpace space = calculateAxisSpace(g2, area);
9
        Rectangle2D dataArea = space.shrink(area, null);
8
        Rectangle2D dataArea = space.shrink(area, null);
9
        //this.axisOffset.trim(dataArea);
10
        // set the width and height of non-shared axis of all sub-plots
10
        // set the width and height of non-shared axis of all sub-plots
11
        setFixedDomainAxisSpaceForSubplots(space);
11
        setFixedDomainAxisSpaceForSubplots(space);
12
        // draw the shared axis
12
        // draw the shared axis
13
        ValueAxis axis = getRangeAxis();
13
        ValueAxis axis = getRangeAxis();
14
        RectangleEdge rangeEdge = getRangeAxisEdge();
14
        RectangleEdge edge = getRangeAxisEdge();
15
        double cursor = RectangleEdge.coordinate(dataArea, rangeEdge);
15
        double cursor = RectangleEdge.coordinate(dataArea, edge);
16
        AxisState state = axis.draw(g2, cursor, area, dataArea, rangeEdge, 
16
        AxisState axisState = axis.draw(g2, cursor, area, dataArea, 
17
                info);
17
edge, info);
18
        if (parentState == null) {
18
        if (parentState == null) {
19
            parentState = new PlotState();
19
            parentState = new PlotState();
20
        }
20
        }
21
        parentState.getSharedAxisStates().put(axis, state);
21
        parentState.getSharedAxisStates().put(axis, axisState);
22
        
23
        // draw all the charts
22
        // draw all the charts
24
        for (int i = 0; i < this.subplots.size(); i++) {
23
        for (int i = 0; i < this.subplots.size(); i++) {
25
            CategoryPlot plot = (CategoryPlot) this.subplots.get(i);
24
            XYPlot plot = (XYPlot) this.subplots.get(i);
26
            PlotRenderingInfo subplotInfo = null;
25
            PlotRenderingInfo subplotInfo = null;
27
            if (info != null) {
26
            if (info != null) {
28
                subplotInfo = new PlotRenderingInfo(info.getOwner());
27
                subplotInfo = new PlotRenderingInfo(info.getOwner());
29
                info.addSubplotInfo(subplotInfo);
28
                info.addSubplotInfo(subplotInfo);
30
            }
29
            }
31
            plot.draw(g2, this.subplotArea[i], null, parentState,
30
            plot.draw(g2, this.subplotAreas[i], anchor, parentState,
32
 subplotInfo);
31
                    subplotInfo);
33
        }
32
        }
34
        if (info != null) {
33
        if (info != null) {
35
            info.setDataArea(dataArea);
34
            info.setDataArea(dataArea);
36
        }
35
        }
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)1.1
Clones locationClones are in different classes having the same super class
Number of node comparisons128
  1. {Refactorable}
    Mapping Summary
    Number of mapped statements23
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)179.4
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    if (info != null)
    1
    if (info != null)
    2
    info.setPlotArea(area);
    2
    info.setPlotArea(area);
    3
    RectangleInsets insets = getInsets();
    3
    RectangleInsets insets = getInsets();
    4
    insets.trim(area);
    4
    insets.trim(area);
    5
    AxisSpace space = calculateAxisSpace(g2, area);
    5
    AxisSpace space = calculateAxisSpace(g2, area);
    6
    Rectangle2D dataArea = space.shrink(area, null);
    6
    Rectangle2D dataArea = space.shrink(area, null);
    7
    setFixedDomainAxisSpaceForSubplots(space);
    7
    setFixedDomainAxisSpaceForSubplots(space);
    8
    ValueAxis axis = getRangeAxis();
    8
    ValueAxis axis = getRangeAxis();
    9
    RectangleEdge rangeEdge = getRangeAxisEdge();
    9
    RectangleEdge rangeEdge = getRangeAxisEdge();
    9
    RectangleEdge edge = getRangeAxisEdge();
    Differences
    Expression1Expression2Difference
    rangeEdgeedgeVARIABLE_NAME_MISMATCH
    9
    RectangleEdge edge = getRangeAxisEdge();
    10
    double cursor = RectangleEdge.coordinate(dataArea, rangeEdge);
    10
    double cursor = RectangleEdge.coordinate(dataArea, rangeEdge);
    10
    double cursor = RectangleEdge.coordinate(dataArea, edge);
    Differences
    Expression1Expression2Difference
    rangeEdgeedgeVARIABLE_NAME_MISMATCH
    10
    double cursor = RectangleEdge.coordinate(dataArea, edge);
    11
    AxisState state = axis.draw(g2, cursor, area, dataArea, rangeEdge, info);
    11
    AxisState state = axis.draw(g2, cursor, area, dataArea, rangeEdge, info);
    11
    AxisState axisState = axis.draw(g2, cursor, area, dataArea, edge, info);
    Differences
    Expression1Expression2Difference
    stateaxisStateVARIABLE_NAME_MISMATCH
    rangeEdgeedgeVARIABLE_NAME_MISMATCH
    11
    AxisState axisState = axis.draw(g2, cursor, area, dataArea, edge, info);
    12
    if (parentState == null)
    12
    if (parentState == null)
    13
    parentState = new PlotState();
    13
    parentState = new PlotState();
    14
    parentState.getSharedAxisStates().put(axis, state);
    14
    parentState.getSharedAxisStates().put(axis, state);
    14
    parentState.getSharedAxisStates().put(axis, axisState);
    Differences
    Expression1Expression2Difference
    stateaxisStateVARIABLE_NAME_MISMATCH
    14
    parentState.getSharedAxisStates().put(axis, axisState);
    15
    for (int i = 0; i < this.subplots.size(); i++)
    15
    for (int i = 0; i < this.subplots.size(); i++)
    16
    CategoryPlot plot = (CategoryPlot)this.subplots.get(i);
    16
    CategoryPlot plot = (CategoryPlot)this.subplots.get(i);
    16
    XYPlot plot = (XYPlot)this.subplots.get(i);
    Differences
    Expression1Expression2Difference
    org.jfree.chart.plot.CategoryPlotorg.jfree.chart.plot.XYPlotSUBCLASS_TYPE_MISMATCH
    org.jfree.chart.plot.CategoryPlotorg.jfree.chart.plot.XYPlotSUBCLASS_TYPE_MISMATCH
    org.jfree.chart.plot.CategoryPlotorg.jfree.chart.plot.XYPlotSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression (CategoryPlot)this.subplots.get(i) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression (XYPlot)this.subplots.get(i) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    16
    XYPlot plot = (XYPlot)this.subplots.get(i);
    17
    PlotRenderingInfo subplotInfo = null;
    17
    PlotRenderingInfo subplotInfo = null;
    18
    if (info != null)
    18
    if (info != null)
    19
    subplotInfo = new PlotRenderingInfo(info.getOwner());
    19
    subplotInfo = new PlotRenderingInfo(info.getOwner());
    20
    info.addSubplotInfo(subplotInfo);
    20
    info.addSubplotInfo(subplotInfo);
    21
    plot.draw(g2, this.subplotArea[i], null, parentState, subplotInfo);
    21
    plot.draw(g2, this.subplotArea[i], null, parentState, subplotInfo);
    21
    plot.draw(g2, this.subplotAreas[i], anchor, parentState, subplotInfo);
    Differences
    Expression1Expression2Difference
    subplotAreasubplotAreasVARIABLE_NAME_MISMATCH
    nullanchorTYPE_COMPATIBLE_REPLACEMENT
    org.jfree.chart.plot.CategoryPlotorg.jfree.chart.plot.XYPlotSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression this.subplotArea cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression this.subplotAreas cannot be parameterized, because it has dependencies to/from statements that will be extracted
    21
    plot.draw(g2, this.subplotAreas[i], anchor, parentState, subplotInfo);
    22
    if (info != null)
    22
    if (info != null)
    23
    info.setDataArea(dataArea);
    23
    info.setDataArea(dataArea);
    Precondition Violations (4)
    Row Violation
    1Expression (CategoryPlot)this.subplots.get(i) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression (XYPlot)this.subplots.get(i) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression this.subplotArea cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Expression this.subplotAreas cannot be parameterized, because it has dependencies to/from statements that will be extracted