for (int k = 0; k < blockCount; k++) { int index = (inverted ? blockCount - k - 1 : k); Object[] prev = (Object[]) values.get(index); Object[] curr = (Object[]) values.get(index + 1); int series = 0; if (curr[0] == null) { series = -((Integer) prev[0]).intValue(); } else { series = ((Integer) curr[0]).intValue(); if (series < 0) { series = -((Integer) prev[0]).intValue(); } } double v0 = ((Double) prev[1]).doubleValue(); double vv0 = rangeAxis.valueToJava2D(v0, dataArea, plot.getRangeAxisEdge()); double v1 = ((Double) curr[1]).doubleValue(); double vv1 = rangeAxis.valueToJava2D(v1, dataArea, plot.getRangeAxisEdge()); Shape[] faces = createHorizontalBlock(barX0, barW, vv0, vv1, inverted); Paint fillPaint = getItemPaint(series, column); Paint fillPaintDark = fillPaint; if (fillPaintDark instanceof Color) { fillPaintDark = ((Color) fillPaint).darker(); } boolean drawOutlines = isDrawBarOutline(); Paint outlinePaint = fillPaint; if (drawOutlines) { outlinePaint = getItemOutlinePaint(series, column); g2.setStroke(getItemOutlineStroke(series, column)); } for (int f = 0; f < 6; f++) { if (f == 5) { g2.setPaint(fillPaint); } else { g2.setPaint(fillPaintDark); } g2.fill(faces[f]); if (drawOutlines) { g2.setPaint(outlinePaint); g2.draw(faces[f]); } } itemLabelList.add(new Object[] {new Integer(series), faces[5].getBounds2D(), BooleanUtilities.valueOf(v0 < getBase())}); // add an item entity, if this information is being collected EntityCollection entities = state.getEntityCollection(); if (entities != null) { addItemEntity(entities, dataset, series, column, faces[5]); } }
for (int k = 0; k < blockCount; k++) { int index = (inverted ? blockCount - k - 1 : k); Object[] prev = (Object[]) values.get(index); Object[] curr = (Object[]) values.get(index + 1); int series = 0; if (curr[0] == null) { series = -((Integer) prev[0]).intValue(); } else { series = ((Integer) curr[0]).intValue(); if (series < 0) { series = -((Integer) prev[0]).intValue(); } } double v0 = ((Double) prev[1]).doubleValue(); double vv0 = rangeAxis.valueToJava2D(v0, dataArea, plot.getRangeAxisEdge()); double v1 = ((Double) curr[1]).doubleValue(); double vv1 = rangeAxis.valueToJava2D(v1, dataArea, plot.getRangeAxisEdge()); Shape[] faces = createVerticalBlock(barX0, barW, vv0, vv1, inverted); Paint fillPaint = getItemPaint(series, column); Paint fillPaintDark = fillPaint; if (fillPaintDark instanceof Color) { fillPaintDark = ((Color) fillPaint).darker(); } boolean drawOutlines = isDrawBarOutline(); Paint outlinePaint = fillPaint; if (drawOutlines) { outlinePaint = getItemOutlinePaint(series, column); g2.setStroke(getItemOutlineStroke(series, column)); } for (int f = 0; f < 6; f++) { if (f == 5) { g2.setPaint(fillPaint); } else { g2.setPaint(fillPaintDark); } g2.fill(faces[f]); if (drawOutlines) { g2.setPaint(outlinePaint); g2.draw(faces[f]); } } itemLabelList.add(new Object[] {new Integer(series), faces[5].getBounds2D(), BooleanUtilities.valueOf(v0 < getBase())}); // add an item entity, if this information is being collected EntityCollection entities = state.getEntityCollection(); if (entities != null) { addItemEntity(entities, dataset, series, column, faces[5]); } }
Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/chart/renderer/category/StackedBarRenderer3D.java File path: /jfreechart-1.0.10/src/org/jfree/chart/renderer/category/StackedBarRenderer3D.java
Method name: void drawStackHorizontal(List, Comparable, Graphics2D, CategoryItemRendererState, Rectangle2D, CategoryPlot, CategoryAxis, ValueAxis, CategoryDataset) Method name: void drawStackVertical(List, Comparable, Graphics2D, CategoryItemRendererState, Rectangle2D, CategoryPlot, CategoryAxis, ValueAxis, CategoryDataset)
Number of AST nodes: 36 Number of AST nodes: 36
1
for (int k = 0; k < blockCount; k++) {
1
for (int k = 0; k < blockCount; k++) {
2
            int index = (inverted ? blockCount - k - 1 : k);
2
            int index = (inverted ? blockCount - k - 1 : k);
3
            Object[] prev = (Object[]) values.get(index);
3
            Object[] prev = (Object[]) values.get(index);
4
            Object[] curr = (Object[]) values.get(index + 1);
4
            Object[] curr = (Object[]) values.get(index + 1);
5
            int series = 0;
5
            int series = 0;
6
            if (curr[0] == null) {
6
            if (curr[0] == null) {
7
                series = -((Integer) prev[0]).intValue();
7
                series = -((Integer) prev[0]).intValue();
8
            }
8
            }
9
            else {
9
            else {
10
                series = ((Integer) curr[0]).intValue();
10
                series = ((Integer) curr[0]).intValue();
11
                if (series < 0) {
11
                if (series < 0) {
12
                    series = -((Integer) prev[0]).intValue();
12
                    series = -((Integer) prev[0]).intValue();
13
                }
13
                }
14
            }
14
            }
15
            double v0 = ((Double) prev[1]).doubleValue();
15
            double v0 = ((Double) prev[1]).doubleValue();
16
            double vv0 = rangeAxis.valueToJava2D(v0, dataArea,
16
            double vv0 = rangeAxis.valueToJava2D(v0, dataArea,
17
                    plot.getRangeAxisEdge());
17
                    plot.getRangeAxisEdge());
18
            double v1 = ((Double) curr[1]).doubleValue();
18
            double v1 = ((Double) curr[1]).doubleValue();
19
            double vv1 = rangeAxis.valueToJava2D(v1, dataArea,
19
            double vv1 = rangeAxis.valueToJava2D(v1, dataArea,
20
                    plot.getRangeAxisEdge());
20
                    plot.getRangeAxisEdge());
21
            Shape[] faces = createHorizontalBlock(barX0, barW, vv0, vv1,
21
            Shape[] faces = createVerticalBlock(barX0, barW, vv0, vv1,
22
                    inverted);
22
                    inverted);
23
            Paint fillPaint = getItemPaint(series, column);
23
            Paint fillPaint = getItemPaint(series, column);
24
            Paint fillPaintDark = fillPaint;
24
            Paint fillPaintDark = fillPaint;
25
            if (fillPaintDark instanceof Color) {
25
            if (fillPaintDark instanceof Color) {
26
                fillPaintDark = ((Color) fillPaint).darker();
26
                fillPaintDark = ((Color) fillPaint).darker();
27
            }
27
            }
28
            boolean drawOutlines = isDrawBarOutline();
28
            boolean drawOutlines = isDrawBarOutline();
29
            Paint outlinePaint = fillPaint;
29
            Paint outlinePaint = fillPaint;
30
            if (drawOutlines) {
30
            if (drawOutlines) {
31
                outlinePaint = getItemOutlinePaint(series, column);
31
                outlinePaint = getItemOutlinePaint(series, column);
32
                g2.setStroke(getItemOutlineStroke(series, column));
32
                g2.setStroke(getItemOutlineStroke(series, column));
33
            }
33
            }
34
            for (int f = 0; f < 6; f++) {
34
            for (int f = 0; f < 6; f++) {
35
                if (f == 5) {
35
                if (f == 5) {
36
                    g2.setPaint(fillPaint);
36
                    g2.setPaint(fillPaint);
37
                }
37
                }
38
                else {
38
                else {
39
                    g2.setPaint(fillPaintDark);
39
                    g2.setPaint(fillPaintDark);
40
                }
40
                }
41
                g2.fill(faces[f]);
41
                g2.fill(faces[f]);
42
                if (drawOutlines) {
42
                if (drawOutlines) {
43
                    g2.setPaint(outlinePaint);
43
                    g2.setPaint(outlinePaint);
44
                    g2.draw(faces[f]);
44
                    g2.draw(faces[f]);
45
                }
45
                }
46
            }
46
            }
47
            itemLabelList.add(new Object[] {new Integer(series),
47
            itemLabelList.add(new Object[] {new Integer(series),
48
                    faces[5].getBounds2D(),
48
                    faces[5].getBounds2D(),
49
                    BooleanUtilities.valueOf(v0 < getBase())});
49
                    BooleanUtilities.valueOf(v0 < getBase())});
50
            // add an item entity, if this information is being collected
50
            // add an item entity, if this information is being collected
51
            EntityCollection entities = state.getEntityCollection();
51
            EntityCollection entities = state.getEntityCollection();
52
            if (entities != null) {
52
            if (entities != null) {
53
                addItemEntity(entities, dataset, series, column, faces[5]);
53
                addItemEntity(entities, dataset, series, column, faces[5]);
54
            }
54
            }
55
        }
55
        }
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.5
Clones locationClones are declared in the same class
Number of node comparisons382
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements36
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)47.9
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    7
    for (int k = 0; k < blockCount; k++)
    7
    for (int k = 0; k < blockCount; k++)
    8
    int index = (inverted ? blockCount - k - 1 : k);
    8
    int index = (inverted ? blockCount - k - 1 : k);
    9
    Object[] prev = (Object[])values.get(index);
    9
    Object[] prev = (Object[])values.get(index);
    10
    Object[] curr = (Object[])values.get(index + 1);
    10
    Object[] curr = (Object[])values.get(index + 1);
    11
    int series = 0;
    11
    int series = 0;
    12
    if (curr[0] == null)
    12
    if (curr[0] == null)
    13
    series = -((Integer)prev[0]).intValue();
    13
    series = -((Integer)prev[0]).intValue();
    else
    else
    14
    series = ((Integer)curr[0]).intValue();
    14
    series = ((Integer)curr[0]).intValue();
    15
    if (series < 0)
    15
    if (series < 0)
    16
    series = -((Integer)prev[0]).intValue();
    16
    series = -((Integer)prev[0]).intValue();
    17
    double v0 = ((Double)prev[1]).doubleValue();
    17
    double v0 = ((Double)prev[1]).doubleValue();
    18
    double vv0 = rangeAxis.valueToJava2D(v0, dataArea, plot.getRangeAxisEdge());
    18
    double vv0 = rangeAxis.valueToJava2D(v0, dataArea, plot.getRangeAxisEdge());
    19
    double v1 = ((Double)curr[1]).doubleValue();
    19
    double v1 = ((Double)curr[1]).doubleValue();
    20
    double vv1 = rangeAxis.valueToJava2D(v1, dataArea, plot.getRangeAxisEdge());
    20
    double vv1 = rangeAxis.valueToJava2D(v1, dataArea, plot.getRangeAxisEdge());
    21
    Shape[] faces = createHorizontalBlock(barX0, barW, vv0, vv1, inverted);
    21
    Shape[] faces = createHorizontalBlock(barX0, barW, vv0, vv1, inverted);
    21
    Shape[] faces = createVerticalBlock(barX0, barW, vv0, vv1, inverted);
    Differences
    Expression1Expression2Difference
    createHorizontalBlockcreateVerticalBlockMETHOD_INVOCATION_NAME_MISMATCH
    Preondition Violations
    Expression createHorizontalBlock(barX0,barW,vv0,vv1,inverted) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    • Inline private method createHorizontalBlock
    Expression createVerticalBlock(barX0,barW,vv0,vv1,inverted) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    • Inline private method createVerticalBlock
    21
    Shape[] faces = createVerticalBlock(barX0, barW, vv0, vv1, inverted);
    22
    Paint fillPaint = getItemPaint(series, column);
    22
    Paint fillPaint = getItemPaint(series, column);
    23
    Paint fillPaintDark = fillPaint;
    23
    Paint fillPaintDark = fillPaint;
    24
    if (fillPaintDark instanceof Color)
    24
    if (fillPaintDark instanceof Color)
    25
    fillPaintDark = ((Color)fillPaint).darker();
    25
    fillPaintDark = ((Color)fillPaint).darker();
    26
    boolean drawOutlines = isDrawBarOutline();
    26
    boolean drawOutlines = isDrawBarOutline();
    27
    Paint outlinePaint = fillPaint;
    27
    Paint outlinePaint = fillPaint;
    28
    if (drawOutlines)
    28
    if (drawOutlines)
    29
    outlinePaint = getItemOutlinePaint(series, column);
    29
    outlinePaint = getItemOutlinePaint(series, column);
    30
    g2.setStroke(getItemOutlineStroke(series, column));
    30
    g2.setStroke(getItemOutlineStroke(series, column));
    31
    for (int f = 0; f < 6; f++)
    31
    for (int f = 0; f < 6; f++)
    32
    if (f == 5)
    32
    if (f == 5)
    33
    g2.setPaint(fillPaint);
    33
    g2.setPaint(fillPaint);
    else
    else
    34
    g2.setPaint(fillPaintDark);
    34
    g2.setPaint(fillPaintDark);
    35
    g2.fill(faces[f]);
    35
    g2.fill(faces[f]);
    36
    if (drawOutlines)
    36
    if (drawOutlines)
    37
    g2.setPaint(outlinePaint);
    37
    g2.setPaint(outlinePaint);
    38
    g2.draw(faces[f]);
    38
    g2.draw(faces[f]);
    39
    itemLabelList.add(new Object[] {new Integer(series), faces[5].getBounds2D(), BooleanUtilities.valueOf(v0 < getBase())});
    39
    itemLabelList.add(new Object[] {new Integer(series), faces[5].getBounds2D(), BooleanUtilities.valueOf(v0 < getBase())});
    40
    EntityCollection entities = state.getEntityCollection();
    40
    EntityCollection entities = state.getEntityCollection();
    41
    if (entities != null)
    41
    if (entities != null)
    42
    addItemEntity(entities, dataset, series, column, faces[5]);
    42
    addItemEntity(entities, dataset, series, column, faces[5]);
    Precondition Violations (2)
    Row Violation
    1Expression createHorizontalBlock(barX0,barW,vv0,vv1,inverted) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression createVerticalBlock(barX0,barW,vv0,vv1,inverted) cannot be parameterized, because it has dependencies to/from statements that will be extracted