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