double space = 0.0; if (orientation == PlotOrientation.HORIZONTAL) { space = dataArea.getHeight(); } else { space = dataArea.getWidth(); } double barW0 = domainAxis.getCategoryStart(column, getColumnCount(), dataArea, plot.getDomainAxisEdge()); int seriesCount = getRowCount(); int categoryCount = getColumnCount(); if (seriesCount > 1) { double seriesGap = space * getItemMargin() / (categoryCount * (seriesCount - 1)); double seriesW = calculateSeriesWidth(space, domainAxis, categoryCount, seriesCount); barW0 = barW0 + row * (seriesW + seriesGap) + (seriesW / 2.0) - (state.getBarWidth() / 2.0); } else { barW0 = domainAxis.getCategoryMiddle(column, getColumnCount(), dataArea, plot.getDomainAxisEdge()) - state.getBarWidth() / 2.0; } return barW0;
double space = 0.0; if (orientation == PlotOrientation.HORIZONTAL) { space = dataArea.getHeight(); } else { space = dataArea.getWidth(); } double barW0 = domainAxis.getCategoryStart(column, getColumnCount(), dataArea, plot.getDomainAxisEdge()); int seriesCount = getRowCount(); int categoryCount = getColumnCount(); if (seriesCount > 1) { double seriesGap = space * getItemMargin() / (categoryCount * (seriesCount - 1)); double seriesW = calculateSeriesWidth(space, domainAxis, categoryCount, seriesCount); barW0 = barW0 + row * (seriesW + seriesGap) + (seriesW / 2.0) - (state.getBarWidth() / 2.0); } else { barW0 = domainAxis.getCategoryMiddle(column, getColumnCount(), dataArea, plot.getDomainAxisEdge()) - state.getBarWidth() / 2.0; } return barW0;
Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/chart/renderer/category/BarRenderer.java File path: /jfreechart-1.0.10/src/org/jfree/chart/renderer/category/LevelRenderer.java
Method name: double calculateBarW0(CategoryPlot, PlotOrientation, Rectangle2D, CategoryAxis, CategoryItemRendererState, int, int) Method name: double calculateBarW0(CategoryPlot, PlotOrientation, Rectangle2D, CategoryAxis, CategoryItemRendererState, int, int)
Number of AST nodes: 13 Number of AST nodes: 13
1
double space = 0.0;
1
double space = 0.0;
2
        if (orientation == PlotOrientation.HORIZONTAL) {
2
        if (orientation == PlotOrientation.HORIZONTAL) {
3
            space = dataArea.getHeight();
3
            space = dataArea.getHeight();
4
        }
4
        }
5
        else {
5
        else {
6
            space = dataArea.getWidth();
6
            space = dataArea.getWidth();
7
        }
7
        }
8
        double barW0 = domainAxis.getCategoryStart(column, getColumnCount(),
8
        double barW0 = domainAxis.getCategoryStart(column, getColumnCount(),
9
                dataArea, plot.getDomainAxisEdge());
9
                dataArea, plot.getDomainAxisEdge());
10
        int seriesCount = getRowCount();
10
        int seriesCount = getRowCount();
11
        int categoryCount = getColumnCount();
11
        int categoryCount = getColumnCount();
12
        if (seriesCount > 1) {
12
        if (seriesCount > 1) {
13
            double seriesGap = space * getItemMargin()
13
            double seriesGap = space * getItemMargin()
14
                               / (categoryCount * (seriesCount - 1));
14
                    / (categoryCount * (seriesCount - 1));
15
            double seriesW = calculateSeriesWidth(space, domainAxis,
15
            double seriesW = calculateSeriesWidth(space, domainAxis,
16
                    categoryCount, seriesCount);
16
                    categoryCount, seriesCount);
17
            barW0 = barW0 + row * (seriesW + seriesGap)
17
            barW0 = barW0 + row * (seriesW + seriesGap)
18
                          + (seriesW / 2.0) - (state.getBarWidth() / 2.0);
18
                          + (seriesW / 2.0) - (state.getBarWidth() / 2.0);
19
        }
19
        }
20
        else {
20
        else {
21
            barW0 = domainAxis.getCategoryMiddle(column, getColumnCount(),
21
            barW0 = domainAxis.getCategoryMiddle(column, getColumnCount(),
22
                    dataArea, plot.getDomainAxisEdge()) - state.getBarWidth()
22
                    dataArea, plot.getDomainAxisEdge()) - state.getBarWidth()
23
                    / 2.0;
23
                    / 2.0;
24
        }
24
        }
25
        return barW0;
25
        return barW0;
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.5
Clones locationClones are in different classes having the same super class
Number of node comparisons75
  1. {Refactorable}
    Mapping Summary
    Number of mapped statements13
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)49.0
    Clone typeType 1
    Mapped Statements
    ID Statement ID Statement
    1
    double space = 0.0;
    1
    double space = 0.0;
    2
    if (orientation == PlotOrientation.HORIZONTAL)
    2
    if (orientation == PlotOrientation.HORIZONTAL)
    3
    space = dataArea.getHeight();
    3
    space = dataArea.getHeight();
    else
    else
    4
    space = dataArea.getWidth();
    4
    space = dataArea.getWidth();
    5
    double barW0 = domainAxis.getCategoryStart(column, getColumnCount(), dataArea, plot.getDomainAxisEdge());
    5
    double barW0 = domainAxis.getCategoryStart(column, getColumnCount(), dataArea, plot.getDomainAxisEdge());
    6
    int seriesCount = getRowCount();
    6
    int seriesCount = getRowCount();
    7
    int categoryCount = getColumnCount();
    7
    int categoryCount = getColumnCount();
    8
    if (seriesCount > 1)
    8
    if (seriesCount > 1)
    9
    double seriesGap = space * getItemMargin() / (categoryCount * (seriesCount - 1));
    9
    double seriesGap = space * getItemMargin() / (categoryCount * (seriesCount - 1));
    10
    double seriesW = calculateSeriesWidth(space, domainAxis, categoryCount, seriesCount);
    10
    double seriesW = calculateSeriesWidth(space, domainAxis, categoryCount, seriesCount);
    11
    barW0 = barW0 + row * (seriesW + seriesGap) + (seriesW / 2.0) - (state.getBarWidth() / 2.0);
    11
    barW0 = barW0 + row * (seriesW + seriesGap) + (seriesW / 2.0) - (state.getBarWidth() / 2.0);
    else
    else
    12
    barW0 = domainAxis.getCategoryMiddle(column, getColumnCount(), dataArea, plot.getDomainAxisEdge()) - state.getBarWidth() / 2.0;
    12
    barW0 = domainAxis.getCategoryMiddle(column, getColumnCount(), dataArea, plot.getDomainAxisEdge()) - state.getBarWidth() / 2.0;
    13
    return barW0;
    13
    return barW0;
    Precondition Violations (0)
    Row Violation