for (int i = 0; i < n; i++) { XYPlot plot = (XYPlot) this.subplots.get(i); // calculate sub-plot area if (orientation == PlotOrientation.HORIZONTAL) { double w = usableSize * plot.getWeight() / this.totalWeight; this.subplotAreas[i] = new Rectangle2D.Double(x, y, w, adjustedPlotArea.getHeight()); x = x + w + this.gap; } else if (orientation == PlotOrientation.VERTICAL) { double h = usableSize * plot.getWeight() / this.totalWeight; this.subplotAreas[i] = new Rectangle2D.Double(x, y, adjustedPlotArea.getWidth(), h); y = y + h + this.gap; } AxisSpace subSpace = plot.calculateRangeAxisSpace(g2, this.subplotAreas[i], null); space.ensureAtLeast(subSpace); }
for (int i = 0; i < n; i++) { CategoryPlot plot = (CategoryPlot) this.subplots.get(i); // calculate sub-plot area if (orientation == PlotOrientation.VERTICAL) { double w = usableSize * plot.getWeight() / this.totalWeight; this.subplotArea[i] = new Rectangle2D.Double(x, y, w, adjustedPlotArea.getHeight()); x = x + w + this.gap; } else if (orientation == PlotOrientation.HORIZONTAL) { double h = usableSize * plot.getWeight() / this.totalWeight; this.subplotArea[i] = new Rectangle2D.Double(x, y, adjustedPlotArea.getWidth(), h); y = y + h + this.gap; } AxisSpace subSpace = plot.calculateDomainAxisSpace(g2, this.subplotArea[i], null); space.ensureAtLeast(subSpace); }
Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/chart/plot/CombinedDomainXYPlot.java File path: /jfreechart-1.0.10/src/org/jfree/chart/plot/CombinedRangeCategoryPlot.java
Method name: AxisSpace calculateAxisSpace(Graphics2D, Rectangle2D) Method name: AxisSpace calculateAxisSpace(Graphics2D, Rectangle2D)
Number of AST nodes: 12 Number of AST nodes: 12
1
for (int i = 0; i < n; i++) {
1
for (int i = 0; i < n; i++) {
2
            XYPlot plot = (XYPlot) this.subplots.get(i);
2
            CategoryPlot plot = (CategoryPlot) this.subplots.get(i);
3
            // calculate sub-plot area
3
            // calculate sub-plot area
4
            if (orientation == PlotOrientation.HORIZONTAL) {
4
            if (orientation == PlotOrientation.VERTICAL) {
5
                double w = usableSize * plot.getWeight() / this.totalWeight;
5
                double w = usableSize * plot.getWeight() / this.totalWeight;
6
                this.subplotAreas[i] = new Rectangle2D.Double(x, y, w,
6
                this.subplotArea[i] = new Rectangle2D.Double(x, y, w, 
7
                        adjustedPlotArea.getHeight());
7
                        adjustedPlotArea.getHeight());
8
                x = x + w + this.gap;
8
                x = x + w + this.gap;
9
            }
9
            }
10
            else if (orientation == PlotOrientation.VERTICAL) {
10
            else if (orientation == PlotOrientation.HORIZONTAL) {
11
                double h = usableSize * plot.getWeight() / this.totalWeight;
11
                double h = usableSize * plot.getWeight() / this.totalWeight;
12
                this.subplotAreas[i] = new Rectangle2D.Double(x, y,
12
                this.subplotArea[i] = new Rectangle2D.Double(x, y, 
13
                        adjustedPlotArea.getWidth(), h);
13
                        adjustedPlotArea.getWidth(), h);
14
                y = y + h + this.gap;
14
                y = y + h + this.gap;
15
            }
15
            }
16
            AxisSpace subSpace = plot.calculateRangeAxisSpace(g2,
16
            AxisSpace subSpace = plot.calculateDomainAxisSpace(g2, 
17
                    this.subplotAreas[i], null);
17
                    this.subplotArea[i], null);
18
            space.ensureAtLeast(subSpace);
18
            space.ensureAtLeast(subSpace);
19
        }
19
        }
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.4
Clones locationClones are in different classes having the same super class
Number of node comparisons65
  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)6.4
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    25
    for (int i = 0; i < n; i++)
    25
    for (int i = 0; i < n; i++)
    26
    XYPlot plot = (XYPlot)this.subplots.get(i);
    26
    XYPlot plot = (XYPlot)this.subplots.get(i);
    26
    CategoryPlot plot = (CategoryPlot)this.subplots.get(i);
    Differences
    Expression1Expression2Difference
    org.jfree.chart.plot.XYPlotorg.jfree.chart.plot.CategoryPlotSUBCLASS_TYPE_MISMATCH
    org.jfree.chart.plot.XYPlotorg.jfree.chart.plot.CategoryPlotSUBCLASS_TYPE_MISMATCH
    org.jfree.chart.plot.XYPlotorg.jfree.chart.plot.CategoryPlotSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression (XYPlot)this.subplots.get(i) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression (CategoryPlot)this.subplots.get(i) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    26
    CategoryPlot plot = (CategoryPlot)this.subplots.get(i);
    27
    if (orientation == PlotOrientation.HORIZONTAL)
    27
    if (orientation == PlotOrientation.HORIZONTAL)
    27
    if (orientation == PlotOrientation.VERTICAL)
    Differences
    Expression1Expression2Difference
    HORIZONTALVERTICALVARIABLE_NAME_MISMATCH
    27
    if (orientation == PlotOrientation.VERTICAL)
    28
    double w = usableSize * plot.getWeight() / this.totalWeight;
    28
    double w = usableSize * plot.getWeight() / this.totalWeight;
    28
    double w = usableSize * plot.getWeight() / this.totalWeight;
    Differences
    Expression1Expression2Difference
    org.jfree.chart.plot.XYPlotorg.jfree.chart.plot.CategoryPlotSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression plot cannot be unified with expression plot , because common superclass org.jfree.chart.plot.Plot does not declare member(s) public int getWeight()
    28
    double w = usableSize * plot.getWeight() / this.totalWeight;
    29
    this.subplotAreas[i] = new Rectangle2D.Double(x, y, w, adjustedPlotArea.getHeight());
    29
    this.subplotAreas[i] = new Rectangle2D.Double(x, y, w, adjustedPlotArea.getHeight());
    29
    this.subplotArea[i] = new Rectangle2D.Double(x, y, w, adjustedPlotArea.getHeight());
    Differences
    Expression1Expression2Difference
    subplotAreassubplotAreaVARIABLE_NAME_MISMATCH
    Preondition Violations
    Expression this.subplotAreas cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression this.subplotArea cannot be parameterized, because it has dependencies to/from statements that will be extracted
    29
    this.subplotArea[i] = new Rectangle2D.Double(x, y, w, adjustedPlotArea.getHeight());
    30
    x = x + w + this.gap;
    30
    x = x + w + this.gap;
    31
    else if (orientation == PlotOrientation.VERTICAL)
    31
    else if (orientation == PlotOrientation.VERTICAL)
    31
    else if (orientation == PlotOrientation.HORIZONTAL)
    Differences
    Expression1Expression2Difference
    VERTICALHORIZONTALVARIABLE_NAME_MISMATCH
    31
    else if (orientation == PlotOrientation.HORIZONTAL)
    32
    double h = usableSize * plot.getWeight() / this.totalWeight;
    32
    double h = usableSize * plot.getWeight() / this.totalWeight;
    32
    double h = usableSize * plot.getWeight() / this.totalWeight;
    Differences
    Expression1Expression2Difference
    org.jfree.chart.plot.XYPlotorg.jfree.chart.plot.CategoryPlotSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression plot cannot be unified with expression plot , because common superclass org.jfree.chart.plot.Plot does not declare member(s) public int getWeight()
    32
    double h = usableSize * plot.getWeight() / this.totalWeight;
    33
    this.subplotAreas[i] = new Rectangle2D.Double(x, y, adjustedPlotArea.getWidth(), h);
    33
    this.subplotAreas[i] = new Rectangle2D.Double(x, y, adjustedPlotArea.getWidth(), h);
    33
    this.subplotArea[i] = new Rectangle2D.Double(x, y, adjustedPlotArea.getWidth(), h);
    Differences
    Expression1Expression2Difference
    subplotAreassubplotAreaVARIABLE_NAME_MISMATCH
    Preondition Violations
    Expression this.subplotAreas cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression this.subplotArea cannot be parameterized, because it has dependencies to/from statements that will be extracted
    33
    this.subplotArea[i] = new Rectangle2D.Double(x, y, adjustedPlotArea.getWidth(), h);
    34
    y = y + h + this.gap;
    34
    y = y + h + this.gap;
    35
    AxisSpace subSpace = plot.calculateRangeAxisSpace(g2, this.subplotAreas[i], null);
    35
    AxisSpace subSpace = plot.calculateRangeAxisSpace(g2, this.subplotAreas[i], null);
    35
    AxisSpace subSpace = plot.calculateDomainAxisSpace(g2, this.subplotArea[i], null);
    Differences
    Expression1Expression2Difference
    calculateRangeAxisSpacecalculateDomainAxisSpaceMETHOD_INVOCATION_NAME_MISMATCH
    subplotAreassubplotAreaVARIABLE_NAME_MISMATCH
    org.jfree.chart.plot.XYPlotorg.jfree.chart.plot.CategoryPlotSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression plot.calculateRangeAxisSpace(g2,this.subplotAreas[i],null) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression plot.calculateDomainAxisSpace(g2,this.subplotArea[i],null) 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
    Expression this.subplotArea cannot be parameterized, because it has dependencies to/from statements that will be extracted
    35
    AxisSpace subSpace = plot.calculateDomainAxisSpace(g2, this.subplotArea[i], null);
    36
    space.ensureAtLeast(subSpace);
    36
    space.ensureAtLeast(subSpace);
    Precondition Violations (12)
    Row Violation
    1Expression (XYPlot)this.subplots.get(i) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression (CategoryPlot)this.subplots.get(i) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression plot cannot be unified with expression plot , because common superclass org.jfree.chart.plot.Plot does not declare member(s) public int getWeight()
    4Expression this.subplotAreas cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5Expression this.subplotArea cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6Expression plot cannot be unified with expression plot , because common superclass org.jfree.chart.plot.Plot does not declare member(s) public int getWeight()
    7Expression this.subplotAreas cannot be parameterized, because it has dependencies to/from statements that will be extracted
    8Expression this.subplotArea cannot be parameterized, because it has dependencies to/from statements that will be extracted
    9Expression plot.calculateRangeAxisSpace(g2,this.subplotAreas[i],null) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    10Expression plot.calculateDomainAxisSpace(g2,this.subplotArea[i],null) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    11Expression this.subplotAreas cannot be parameterized, because it has dependencies to/from statements that will be extracted
    12Expression this.subplotArea cannot be parameterized, because it has dependencies to/from statements that will be extracted