for (int i = 0; i < leftKeys.getItemCount(); i++) { String label = this.labelGenerator.generateSectionLabel( this.dataset, leftKeys.getKey(i)); if (label != null) { TextBlock block = TextUtilities.createTextBlock(label, this.labelFont, this.labelPaint, maxLabelWidth, new G2TextMeasurer(g2)); TextBox labelBox = new TextBox(block); labelBox.setBackgroundPaint(this.labelBackgroundPaint); labelBox.setOutlinePaint(this.labelOutlinePaint); labelBox.setOutlineStroke(this.labelOutlineStroke); labelBox.setShadowPaint(this.labelShadowPaint); labelBox.setInteriorGap(this.labelPadding); double theta = Math.toRadians( leftKeys.getValue(i).doubleValue()); double baseY = state.getPieCenterY() - Math.sin(theta) * verticalLinkRadius; double hh = labelBox.getHeight(g2); this.labelDistributor.addPieLabelRecord(new PieLabelRecord( leftKeys.getKey(i), theta, baseY, labelBox, hh, lGap / 2.0 + lGap / 2.0 * -Math.cos(theta), 0.9 + getExplodePercent(leftKeys.getKey(i)))); } }
for (int i = 0; i < keys.getItemCount(); i++) { String label = this.labelGenerator.generateSectionLabel( this.dataset, keys.getKey(i)); if (label != null) { TextBlock block = TextUtilities.createTextBlock(label, this.labelFont, this.labelPaint, maxLabelWidth, new G2TextMeasurer(g2)); TextBox labelBox = new TextBox(block); labelBox.setBackgroundPaint(this.labelBackgroundPaint); labelBox.setOutlinePaint(this.labelOutlinePaint); labelBox.setOutlineStroke(this.labelOutlineStroke); labelBox.setShadowPaint(this.labelShadowPaint); labelBox.setInteriorGap(this.labelPadding); double theta = Math.toRadians(keys.getValue(i).doubleValue()); double baseY = state.getPieCenterY() - Math.sin(theta) * verticalLinkRadius; double hh = labelBox.getHeight(g2); this.labelDistributor.addPieLabelRecord(new PieLabelRecord( keys.getKey(i), theta, baseY, labelBox, hh, lGap / 2.0 + lGap / 2.0 * Math.cos(theta), 0.9 + getExplodePercent(keys.getKey(i)))); } }
Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/chart/plot/PiePlot.java File path: /jfreechart-1.0.10/src/org/jfree/chart/plot/PiePlot.java
Method name: void drawLeftLabels(KeyedValues, Graphics2D, Rectangle2D, Rectangle2D, float, PiePlotState) Method name: void drawRightLabels(KeyedValues, Graphics2D, Rectangle2D, Rectangle2D, float, PiePlotState)
Number of AST nodes: 14 Number of AST nodes: 14
1
for (int i = 0; i < leftKeys.getItemCount(); i++) {   
1
for (int i = 0; i < keys.getItemCount(); i++) {
2
            String label = this.labelGenerator.generateSectionLabel(
2
            String label = this.labelGenerator.generateSectionLabel(
3
                    this.dataset, leftKeys.getKey(i));
3
                    this.dataset, keys.getKey(i));
4
            if (label != null) {
4
            if (label != null) {
5
                TextBlock block = TextUtilities.createTextBlock(label, 
5
                TextBlock block = TextUtilities.createTextBlock(label, 
6
                        this.labelFont, this.labelPaint, maxLabelWidth, 
6
                        this.labelFont, this.labelPaint, maxLabelWidth, 
7
                        new G2TextMeasurer(g2));
7
                        new G2TextMeasurer(g2));
8
                TextBox labelBox = new TextBox(block);
8
                TextBox labelBox = new TextBox(block);
9
                labelBox.setBackgroundPaint(this.labelBackgroundPaint);
9
                labelBox.setBackgroundPaint(this.labelBackgroundPaint);
10
                labelBox.setOutlinePaint(this.labelOutlinePaint);
10
                labelBox.setOutlinePaint(this.labelOutlinePaint);
11
                labelBox.setOutlineStroke(this.labelOutlineStroke);
11
                labelBox.setOutlineStroke(this.labelOutlineStroke);
12
                labelBox.setShadowPaint(this.labelShadowPaint);
12
                labelBox.setShadowPaint(this.labelShadowPaint);
13
                labelBox.setInteriorGap(this.labelPadding);
13
                labelBox.setInteriorGap(this.labelPadding);
14
                double theta = Math.toRadians(
14
                double theta = Math.toRadians(
15
                        leftKeys.getValue(i).doubleValue());
15
keys.getValue(i).doubleValue());
16
                double baseY = state.getPieCenterY() - Math.sin(theta) 
16
                double baseY = state.getPieCenterY() 
17
                               * verticalLinkRadius;
17
                              - Math.sin(theta) * verticalLinkRadius;
18
                double hh = labelBox.getHeight(g2);
18
                double hh = labelBox.getHeight(g2);
19
                this.labelDistributor.addPieLabelRecord(new PieLabelRecord(
19
                this.labelDistributor.addPieLabelRecord(new PieLabelRecord(
20
                        leftKeys.getKey(i), theta, baseY, labelBox, hh,
20
                        keys.getKey(i), theta, baseY, labelBox, hh,
21
                        lGap / 2.0 + lGap / 2.0 * -Math.cos(theta), 0.9 
21
                        lGap / 2.0 + lGap / 2.0 * Math.cos(theta), 
22
                        + getExplodePercent(leftKeys.getKey(i))));
22
                        0.9 + getExplodePercent(keys.getKey(i))));
23
            }
23
            }
24
        }
24
        }
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.8
Clones locationClones are declared in the same class
Number of node comparisons150
  1. {Refactorable}
    Mapping Summary
    Number of mapped statements14
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)233.5
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    4
    for (int i = 0; i < leftKeys.getItemCount(); i++)
    4
    for (int i = 0; i < leftKeys.getItemCount(); i++)
    4
    for (int i = 0; i < keys.getItemCount(); i++)
    Differences
    Expression1Expression2Difference
    leftKeyskeysVARIABLE_NAME_MISMATCH
    4
    for (int i = 0; i < keys.getItemCount(); i++)
    5
    String label = this.labelGenerator.generateSectionLabel(this.dataset, leftKeys.getKey(i));
    5
    String label = this.labelGenerator.generateSectionLabel(this.dataset, leftKeys.getKey(i));
    5
    String label = this.labelGenerator.generateSectionLabel(this.dataset, keys.getKey(i));
    Differences
    Expression1Expression2Difference
    leftKeyskeysVARIABLE_NAME_MISMATCH
    5
    String label = this.labelGenerator.generateSectionLabel(this.dataset, keys.getKey(i));
    6
    if (label != null)
    6
    if (label != null)
    7
    TextBlock block = TextUtilities.createTextBlock(label, this.labelFont, this.labelPaint, maxLabelWidth, new G2TextMeasurer(g2));
    7
    TextBlock block = TextUtilities.createTextBlock(label, this.labelFont, this.labelPaint, maxLabelWidth, new G2TextMeasurer(g2));
    8
    TextBox labelBox = new TextBox(block);
    8
    TextBox labelBox = new TextBox(block);
    9
    labelBox.setBackgroundPaint(this.labelBackgroundPaint);
    9
    labelBox.setBackgroundPaint(this.labelBackgroundPaint);
    10
    labelBox.setOutlinePaint(this.labelOutlinePaint);
    10
    labelBox.setOutlinePaint(this.labelOutlinePaint);
    11
    labelBox.setOutlineStroke(this.labelOutlineStroke);
    11
    labelBox.setOutlineStroke(this.labelOutlineStroke);
    12
    labelBox.setShadowPaint(this.labelShadowPaint);
    12
    labelBox.setShadowPaint(this.labelShadowPaint);
    13
    labelBox.setInteriorGap(this.labelPadding);
    13
    labelBox.setInteriorGap(this.labelPadding);
    14
    double theta = Math.toRadians(leftKeys.getValue(i).doubleValue());
    14
    double theta = Math.toRadians(leftKeys.getValue(i).doubleValue());
    14
    double theta = Math.toRadians(keys.getValue(i).doubleValue());
    Differences
    Expression1Expression2Difference
    leftKeyskeysVARIABLE_NAME_MISMATCH
    14
    double theta = Math.toRadians(keys.getValue(i).doubleValue());
    15
    double baseY = state.getPieCenterY() - Math.sin(theta) * verticalLinkRadius;
    15
    double baseY = state.getPieCenterY() - Math.sin(theta) * verticalLinkRadius;
    16
    double hh = labelBox.getHeight(g2);
    16
    double hh = labelBox.getHeight(g2);
    17
    this.labelDistributor.addPieLabelRecord(new PieLabelRecord(leftKeys.getKey(i), theta, baseY, labelBox, hh, lGap / 2.0 + lGap / 2.0 * -Math.cos(theta), 0.9 + getExplodePercent(leftKeys.getKey(i))));
    17
    this.labelDistributor.addPieLabelRecord(new PieLabelRecord(leftKeys.getKey(i), theta, baseY, labelBox, hh, lGap / 2.0 + lGap / 2.0 * -Math.cos(theta), 0.9 + getExplodePercent(leftKeys.getKey(i))));
    17
    this.labelDistributor.addPieLabelRecord(new PieLabelRecord(keys.getKey(i), theta, baseY, labelBox, hh, lGap / 2.0 + lGap / 2.0 * Math.cos(theta), 0.9 + getExplodePercent(keys.getKey(i))));
    Differences
    Expression1Expression2Difference
    leftKeyskeysVARIABLE_NAME_MISMATCH
    -Math.cos(theta)Math.cos(theta)TYPE_COMPATIBLE_REPLACEMENT
    leftKeyskeysVARIABLE_NAME_MISMATCH
    Preondition Violations
    Expression -Math.cos(theta) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression Math.cos(theta) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    17
    this.labelDistributor.addPieLabelRecord(new PieLabelRecord(keys.getKey(i), theta, baseY, labelBox, hh, lGap / 2.0 + lGap / 2.0 * Math.cos(theta), 0.9 + getExplodePercent(keys.getKey(i))));
    Precondition Violations (2)
    Row Violation
    1Expression -Math.cos(theta) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression Math.cos(theta) cannot be parameterized, because it has dependencies to/from statements that will be extracted