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 groups = this.seriesToGroupMap.getGroupCount(); int categories = data.getColumnCount(); int columns = groups * categories; double categoryMargin = 0.0; double itemMargin = 0.0; if (categories > 1) { categoryMargin = xAxis.getCategoryMargin(); } if (groups > 1) { itemMargin = getItemMargin(); } double used = space * (1 - xAxis.getLowerMargin() - xAxis.getUpperMargin() - categoryMargin - itemMargin); if (columns > 0) { state.setBarWidth(Math.min(used / columns, maxWidth)); } else { state.setBarWidth(Math.min(used, maxWidth)); }
int columns = dataset.getColumnCount(); int rows = dataset.getRowCount(); double space = 0.0; PlotOrientation orientation = plot.getOrientation(); if (orientation == PlotOrientation.HORIZONTAL) { space = dataArea.getHeight(); } else if (orientation == PlotOrientation.VERTICAL) { space = dataArea.getWidth(); } double maxWidth = space * getMaximumItemWidth(); double categoryMargin = 0.0; double currentItemMargin = 0.0; if (columns > 1) { categoryMargin = domainAxis.getCategoryMargin(); } if (rows > 1) { currentItemMargin = getItemMargin(); } double used = space * (1 - domainAxis.getLowerMargin() - domainAxis.getUpperMargin() - categoryMargin - currentItemMargin); if ((rows * columns) > 0) { state.setBarWidth(Math.min(used / (rows * 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/GroupedStackedBarRenderer.java File path: /jfreechart-1.0.10/src/org/jfree/chart/renderer/category/LevelRenderer.java
Method name: void calculateBarWidth(CategoryPlot, Rectangle2D, int, CategoryItemRendererState) Method name: void calculateItemWidth(CategoryPlot, Rectangle2D, int, CategoryItemRendererState)
Number of AST nodes: 20 Number of AST nodes: 19
1
int columns = dataset.getColumnCount();
2
            int rows = dataset.getRowCount();
3
            double space = 0.0;
1
PlotOrientation orientation = plot.getOrientation();
4
            PlotOrientation orientation = plot.getOrientation()
2
            double space = 0.0;
5
;
3
            if (orientation == PlotOrientation.HORIZONTAL) {
6
            if (orientation == PlotOrientation.HORIZONTAL) {
4
                space = dataArea.getHeight();
7
                space = dataArea.getHeight();
5
            }
8
            }
6
            else if (orientation == PlotOrientation.VERTICAL) {
9
            else if (orientation == PlotOrientation.VERTICAL) {
7
                space = dataArea.getWidth();
10
                space = dataArea.getWidth();
8
            }
11
            }
9
            double maxWidth = space * getMaximumBarWidth();
12
            double maxWidth = space * getMaximum
10
            int groups = this.seriesToGroupMap.getGroupCount();
11
            int categories = data.getColumnCount();
12
            int columns = groups * categories;
13
ItemWidth();
13
            double categoryMargin = 0.0;
14
            double categoryMargin = 0.0;
14
            double itemMargin = 0.0;
15
            double currentItemMargin = 0.0;
15
            if (categories > 1) {
16
            if (columns > 1) {
16
                categoryMargin = xAxis.getCategoryMargin();
17
                categoryMargin = domainAxis.getCategoryMargin();
17
            }
18
            }
18
            if (groups > 1) {
19
            if (rows > 1) {
19
                itemMargin = getItemMargin();
20
                currentItemMargin = getItemMargin();
20
            }
21
            }
21
            double used = space * (1 - xAxis.getLowerMargin()
22
            double used = space * (1 - domainAxis.getLowerMargin()
22
                                     - xAxis.getUpperMargin()
23
                                     - domainAxis.getUpperMargin()
23
                                     - categoryMargin - itemMargin);
24
                                     - categoryMargin - currentItemMargin);
24
            if (columns > 0) {
25
            if ((rows * columns) > 0) {
25
                state.setBarWidth(Math.min(used / columns, maxWidth));
26
                state.setBarWidth(Math.min(used / (rows * columns), maxWidth));
26
            }
27
            }
27
            else {
28
            else {
28
                state.setBarWidth(Math.min(used, maxWidth));
29
                state.setBarWidth(Math.min(used, maxWidth));
29
            }
30
            }
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)1.4
Clones locationClones are in different classes having the same super class
Number of node comparisons156
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements19
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)6.1
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    4
    PlotOrientation orientation = plot.getOrientation();
    7
    PlotOrientation orientation = plot.getOrientation();
    5
    double space = 0.0;
    6
    double space = 0.0;
    6
    if (orientation == PlotOrientation.HORIZONTAL)
    8
    if (orientation == PlotOrientation.HORIZONTAL)
    7
    space = dataArea.getHeight();
    9
    space = dataArea.getHeight();
    8
    else if (orientation == PlotOrientation.VERTICAL)
    10
    else if (orientation == PlotOrientation.VERTICAL)
    9
    space = dataArea.getWidth();
    11
    space = dataArea.getWidth();
    10
    double maxWidth = space * getMaximumBarWidth();
    10
    double maxWidth = space * getMaximumBarWidth();
    12
    double maxWidth = space * getMaximumItemWidth();
    Differences
    Expression1Expression2Difference
    getMaximumBarWidthgetMaximumItemWidthMETHOD_INVOCATION_NAME_MISMATCH
    12
    double maxWidth = space * getMaximumItemWidth();
    11
    int groups = this.seriesToGroupMap.getGroupCount();
                                                                                                              
    12
    int categories = data.getColumnCount();
    12
    int categories = data.getColumnCount();
    4
    int columns = dataset.getColumnCount();
    Differences
    Expression1Expression2Difference
    categoriescolumnsVARIABLE_NAME_MISMATCH
    datadatasetVARIABLE_NAME_MISMATCH
    4
    int columns = dataset.getColumnCount();
    13
    int columns = groups * categories;
    13
    int columns = groups * categories;
    5
    int rows = dataset.getRowCount();
    Differences
    Expression1Expression2Difference
    columnsrowsVARIABLE_NAME_MISMATCH
    groups * categoriesdataset.getRowCount()TYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression groups * categories cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5
    int rows = dataset.getRowCount();
    14
    double categoryMargin = 0.0;
    13
    double categoryMargin = 0.0;
    15
    double itemMargin = 0.0;
    15
    double itemMargin = 0.0;
    14
    double currentItemMargin = 0.0;
    Differences
    Expression1Expression2Difference
    itemMargincurrentItemMarginVARIABLE_NAME_MISMATCH
    14
    double currentItemMargin = 0.0;
    16
    if (categories > 1)
    16
    if (categories > 1)
    15
    if (columns > 1)
    Differences
    Expression1Expression2Difference
    categoriescolumnsVARIABLE_NAME_MISMATCH
    15
    if (columns > 1)
    17
    categoryMargin = xAxis.getCategoryMargin();
    17
    categoryMargin = xAxis.getCategoryMargin();
    16
    categoryMargin = domainAxis.getCategoryMargin();
    Differences
    Expression1Expression2Difference
    xAxisdomainAxisVARIABLE_NAME_MISMATCH
    16
    categoryMargin = domainAxis.getCategoryMargin();
    18
    if (groups > 1)
    18
    if (groups > 1)
    17
    if (rows > 1)
    Differences
    Expression1Expression2Difference
    groupsrowsVARIABLE_NAME_MISMATCH
    Preondition Violations
    Expression rows cannot be parameterized, because it has dependencies to/from statements that will be extracted
    17
    if (rows > 1)
    19
    itemMargin = getItemMargin();
    19
    itemMargin = getItemMargin();
    18
    currentItemMargin = getItemMargin();
    Differences
    Expression1Expression2Difference
    itemMargincurrentItemMarginVARIABLE_NAME_MISMATCH
    18
    currentItemMargin = getItemMargin();
    20
    double used = space * (1 - xAxis.getLowerMargin() - xAxis.getUpperMargin() - categoryMargin - itemMargin);
    20
    double used = space * (1 - xAxis.getLowerMargin() - xAxis.getUpperMargin() - categoryMargin - itemMargin);
    19
    double used = space * (1 - domainAxis.getLowerMargin() - domainAxis.getUpperMargin() - categoryMargin - currentItemMargin);
    Differences
    Expression1Expression2Difference
    xAxisdomainAxisVARIABLE_NAME_MISMATCH
    itemMargincurrentItemMarginVARIABLE_NAME_MISMATCH
    xAxisdomainAxisVARIABLE_NAME_MISMATCH
    19
    double used = space * (1 - domainAxis.getLowerMargin() - domainAxis.getUpperMargin() - categoryMargin - currentItemMargin);
    21
    if (columns > 0)
    21
    if (columns > 0)
    20
    if ((rows * columns) > 0)
    Differences
    Expression1Expression2Difference
    columns(rows * columns)TYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression columns cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression (rows * columns) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    20
    if ((rows * columns) > 0)
    22
    state.setBarWidth(Math.min(used / columns, maxWidth));
    22
    state.setBarWidth(Math.min(used / columns, maxWidth));
    21
    state.setBarWidth(Math.min(used / (rows * columns), maxWidth));
    Differences
    Expression1Expression2Difference
    columns(rows * columns)TYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression columns cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression (rows * columns) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    21
    state.setBarWidth(Math.min(used / (rows * columns), maxWidth));
    else
    else
    23
    state.setBarWidth(Math.min(used, maxWidth));
    22
    state.setBarWidth(Math.min(used, maxWidth));
    Precondition Violations (6)
    Row Violation
    1Expression groups * categories cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression rows cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression columns cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Expression (rows * columns) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5Expression columns cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6Expression (rows * columns) cannot be parameterized, because it has dependencies to/from statements that will be extracted