if (seriesCount > 1) { double seriesGap = dataArea.getHeight() * getItemMargin() / (categoryCount * (seriesCount - 1)); double usedWidth = (state.getBarWidth() * seriesCount) + (seriesGap * (seriesCount - 1)); // offset the start of the boxes if the total width used is smaller // than the category width double offset = (categoryWidth - usedWidth) / 2; yy = yy + offset + (row * (state.getBarWidth() + seriesGap)); } else { // offset the start of the box if the box width is smaller than // the category width double offset = (categoryWidth - state.getBarWidth()) / 2; yy = yy + offset; }
if (seriesCount > 1) { double seriesGap = dataArea.getWidth() * getItemMargin() / (categoryCount * (seriesCount - 1)); double usedWidth = (state.getBarWidth() * seriesCount) + (seriesGap * (seriesCount - 1)); // offset the start of the boxes if the total width used is smaller // than the category width double offset = (categoryWidth - usedWidth) / 2; xx = xx + offset + (row * (state.getBarWidth() + seriesGap)); } else { // offset the start of the box if the box width is smaller than the // category width double offset = (categoryWidth - state.getBarWidth()) / 2; xx = xx + offset; }
Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/chart/renderer/category/BoxAndWhiskerRenderer.java File path: /jfreechart-1.0.10/src/org/jfree/chart/renderer/category/BoxAndWhiskerRenderer.java
Method name: void drawHorizontalItem(Graphics2D, CategoryItemRendererState, Rectangle2D, CategoryPlot, CategoryAxis, ValueAxis, CategoryDataset, int, int) Method name: void drawVerticalItem(Graphics2D, CategoryItemRendererState, Rectangle2D, CategoryPlot, CategoryAxis, ValueAxis, CategoryDataset, int, int)
Number of AST nodes: 7 Number of AST nodes: 7
1
if (seriesCount > 1) {
1
if (seriesCount > 1) {
2
            double seriesGap = dataArea.getHeight() * getItemMargin()
2
            double seriesGap = dataArea.getWidth() * getItemMargin()
3
                               / (categoryCount * (seriesCount - 1));
3
                               / (categoryCount * (seriesCount - 1));
4
            double usedWidth = (state.getBarWidth() * seriesCount)
4
            double usedWidth = (state.getBarWidth() * seriesCount)
5
                               + (seriesGap * (seriesCount - 1));
5
                               + (seriesGap * (seriesCount - 1));
6
            // offset the start of the boxes if the total width used is smaller
6
            // offset the start of the boxes if the total width used is smaller
7
            // than the category width
7
            // than the category width
8
            double offset = (categoryWidth - usedWidth) / 2;
8
            double offset = (categoryWidth - usedWidth) / 2;
9
            yy = yy + offset + (row * (state.getBarWidth() + seriesGap));
9
            xx = xx + offset + (row * (state.getBarWidth() + seriesGap));
10
        }
10
        }
11
        else {
11
        else {
12
            // offset the start of the box if the box width is smaller than
12
            // offset the start of the box if the box width is smaller than the
13
            // the category width
13
            // category width
14
            double offset = (categoryWidth - state.getBarWidth()) / 2;
14
            double offset = (categoryWidth - state.getBarWidth()) / 2;
15
            yy = yy + offset;
15
            xx = xx + offset;
16
        }
16
        }
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.1
Clones locationClones are declared in the same class
Number of node comparisons49
  1. {Refactorable}
    Mapping Summary
    Number of mapped statements7
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)29.3
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    8
    if (seriesCount > 1)
    8
    if (seriesCount > 1)
    9
    double seriesGap = dataArea.getHeight() * getItemMargin() / (categoryCount * (seriesCount - 1));
    9
    double seriesGap = dataArea.getHeight() * getItemMargin() / (categoryCount * (seriesCount - 1));
    9
    double seriesGap = dataArea.getWidth() * getItemMargin() / (categoryCount * (seriesCount - 1));
    Differences
    Expression1Expression2Difference
    getHeightgetWidthMETHOD_INVOCATION_NAME_MISMATCH
    9
    double seriesGap = dataArea.getWidth() * getItemMargin() / (categoryCount * (seriesCount - 1));
    10
    double usedWidth = (state.getBarWidth() * seriesCount) + (seriesGap * (seriesCount - 1));
    10
    double usedWidth = (state.getBarWidth() * seriesCount) + (seriesGap * (seriesCount - 1));
    11
    double offset = (categoryWidth - usedWidth) / 2;
    11
    double offset = (categoryWidth - usedWidth) / 2;
    12
    yy = yy + offset + (row * (state.getBarWidth() + seriesGap));
    12
    yy = yy + offset + (row * (state.getBarWidth() + seriesGap));
    12
    xx = xx + offset + (row * (state.getBarWidth() + seriesGap));
    Differences
    Expression1Expression2Difference
    yyxxVARIABLE_NAME_MISMATCH
    yyxxVARIABLE_NAME_MISMATCH
    12
    xx = xx + offset + (row * (state.getBarWidth() + seriesGap));
    else
    else
    13
    double offset = (categoryWidth - state.getBarWidth()) / 2;
    13
    double offset = (categoryWidth - state.getBarWidth()) / 2;
    14
    yy = yy + offset;
    14
    yy = yy + offset;
    14
    xx = xx + offset;
    Differences
    Expression1Expression2Difference
    yyxxVARIABLE_NAME_MISMATCH
    yyxxVARIABLE_NAME_MISMATCH
    14
    xx = xx + offset;
    Precondition Violations (0)
    Row Violation