PlotOrientation orientation = plot.getOrientation(); double space = 0.0; if (orientation == PlotOrientation.HORIZONTAL) { space = dataArea.getHeight(); } else if (orientation == PlotOrientation.VERTICAL) { space = dataArea.getWidth(); } double maxWidth = space * getMaximumBarWidth(); int columns = data.getColumnCount(); double categoryMargin = 0.0; if (columns > 1) { categoryMargin = xAxis.getCategoryMargin(); } double used = space * (1 - xAxis.getLowerMargin() - xAxis.getUpperMargin() - categoryMargin); if (columns > 0) { state.setBarWidth(Math.min(used / columns, maxWidth)); } else { state.setBarWidth(Math.min(used, maxWidth)); }
PlotOrientation orientation = plot.getOrientation(); double space = 0.0; if (orientation == PlotOrientation.HORIZONTAL) { space = dataArea.getHeight(); } else if (orientation == PlotOrientation.VERTICAL) { space = dataArea.getWidth(); } double maxWidth = space * getMaximumBarWidth(); int columns = data.getColumnCount(); double categoryMargin = 0.0; if (columns > 1) { categoryMargin = domainAxis.getCategoryMargin(); } double used = space * (1 - domainAxis.getLowerMargin() - domainAxis.getUpperMargin() - categoryMargin); if (columns > 0) { state.setBarWidth(Math.min(used / columns, maxWidth)); } else { state.setBarWidth(Math.min(used, maxWidth)); }
Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/chart/renderer/category/StackedBarRenderer.java File path: /jfreechart-1.0.10/src/org/jfree/chart/renderer/category/StackedBarRenderer3D.java
Method name: void calculateBarWidth(CategoryPlot, Rectangle2D, int, CategoryItemRendererState) Method name: void calculateBarWidth(CategoryPlot, Rectangle2D, int, CategoryItemRendererState)
Number of AST nodes: 15 Number of AST nodes: 15
1
PlotOrientation orientation = plot.getOrientation();
1
PlotOrientation orientation = plot.getOrientation();
2
            double space = 0.0;
2
            double space = 0.0;
3
            if (orientation == PlotOrientation.HORIZONTAL) {
3
            if (orientation == PlotOrientation.HORIZONTAL) {
4
                space = dataArea.getHeight();
4
                space = dataArea.getHeight();
5
            }
5
            }
6
            else if (orientation == PlotOrientation.VERTICAL) {
6
            else if (orientation == PlotOrientation.VERTICAL) {
7
                space = dataArea.getWidth();
7
                space = dataArea.getWidth();
8
            }
8
            }
9
            double maxWidth = space * getMaximumBarWidth();
9
            double maxWidth = space * getMaximumBarWidth();
10
            int columns = data.getColumnCount();
10
            int columns = data.getColumnCount();
11
            double categoryMargin = 0.0;
11
            double categoryMargin = 0.0;
12
            if (columns > 1) {
12
            if (columns > 1) {
13
                categoryMargin = xAxis.getCategoryMargin();
13
                categoryMargin = domainAxis.getCategoryMargin();
14
            }
14
            }
15
            double used = space * (1 - xAxis.getLowerMargin()
15
            double used = space * (1 - domainAxis.getLowerMargin()
16
                                     - xAxis.getUpperMargin()
16
                                     - domainAxis.getUpperMargin()
17
                                     - categoryMargin);
17
                                     - categoryMargin);
18
            if (columns > 0) {
18
            if (columns > 0) {
19
                state.setBarWidth(Math.min(used / columns, maxWidth));
19
                state.setBarWidth(Math.min(used / columns, maxWidth));
20
            }
20
            }
21
            else {
21
            else {
22
                state.setBarWidth(Math.min(used, maxWidth));
22
                state.setBarWidth(Math.min(used, maxWidth));
23
            }
23
            }
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.0
Clones locationClones are in different classes having the same super class
Number of node comparisons94
  1. {Refactorable}
    Mapping Summary
    Number of mapped statements15
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)3.6
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    4
    PlotOrientation orientation = plot.getOrientation();
    4
    PlotOrientation orientation = plot.getOrientation();
    5
    double space = 0.0;
    5
    double space = 0.0;
    6
    if (orientation == PlotOrientation.HORIZONTAL)
    6
    if (orientation == PlotOrientation.HORIZONTAL)
    7
    space = dataArea.getHeight();
    7
    space = dataArea.getHeight();
    8
    else if (orientation == PlotOrientation.VERTICAL)
    8
    else if (orientation == PlotOrientation.VERTICAL)
    9
    space = dataArea.getWidth();
    9
    space = dataArea.getWidth();
    10
    double maxWidth = space * getMaximumBarWidth();
    10
    double maxWidth = space * getMaximumBarWidth();
    11
    int columns = data.getColumnCount();
    11
    int columns = data.getColumnCount();
    12
    double categoryMargin = 0.0;
    12
    double categoryMargin = 0.0;
    13
    if (columns > 1)
    13
    if (columns > 1)
    14
    categoryMargin = xAxis.getCategoryMargin();
    14
    categoryMargin = xAxis.getCategoryMargin();
    14
    categoryMargin = domainAxis.getCategoryMargin();
    Differences
    Expression1Expression2Difference
    xAxisdomainAxisVARIABLE_NAME_MISMATCH
    14
    categoryMargin = domainAxis.getCategoryMargin();
    15
    double used = space * (1 - xAxis.getLowerMargin() - xAxis.getUpperMargin() - categoryMargin);
    15
    double used = space * (1 - xAxis.getLowerMargin() - xAxis.getUpperMargin() - categoryMargin);
    15
    double used = space * (1 - domainAxis.getLowerMargin() - domainAxis.getUpperMargin() - categoryMargin);
    Differences
    Expression1Expression2Difference
    xAxisdomainAxisVARIABLE_NAME_MISMATCH
    xAxisdomainAxisVARIABLE_NAME_MISMATCH
    15
    double used = space * (1 - domainAxis.getLowerMargin() - domainAxis.getUpperMargin() - categoryMargin);
    16
    if (columns > 0)
    16
    if (columns > 0)
    17
    state.setBarWidth(Math.min(used / columns, maxWidth));
    17
    state.setBarWidth(Math.min(used / columns, maxWidth));
    else
    else
    18
    state.setBarWidth(Math.min(used, maxWidth));
    18
    state.setBarWidth(Math.min(used, maxWidth));
    Precondition Violations (0)
    Row Violation