this.labelDistributor.clear(); double lGap = plotArea.getWidth() * this.labelGap; double verticalLinkRadius = state.getLinkArea().getHeight() / 2.0; 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)))); } } double hh = plotArea.getHeight(); double gap = hh * getInteriorGap(); this.labelDistributor.distributeLabels(plotArea.getMinY() + gap, hh - 2 * gap); for (int i = 0; i < this.labelDistributor.getItemCount(); i++) { drawLeftLabel(g2, state, this.labelDistributor.getPieLabelRecord(i)); }
this.labelDistributor.clear(); double lGap = plotArea.getWidth() * this.labelGap; double verticalLinkRadius = state.getLinkArea().getHeight() / 2.0; 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)))); } } double hh = plotArea.getHeight(); double gap = hh * getInteriorGap(); this.labelDistributor.distributeLabels(plotArea.getMinY() + gap, hh - 2 * gap); for (int i = 0; i < this.labelDistributor.getItemCount(); i++) { drawRightLabel(g2, state, this.labelDistributor.getPieLabelRecord(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: 22 Number of AST nodes: 22
1
this.labelDistributor.clear();
1
this.labelDistributor.clear();
2
        double lGap = plotArea.getWidth() * this.labelGap;
2
        double lGap = plotArea.getWidth() * this.labelGap;
3
        double verticalLinkRadius = state.getLinkArea().getHeight() / 2.0;
3
        double verticalLinkRadius = state.getLinkArea().getHeight() / 2.0;
4
        for (int i = 0; i < leftKeys.getItemCount(); i++) {   
4
        for (int i = 0; i < keys.getItemCount(); i++) {
5
            String label = this.labelGenerator.generateSectionLabel(
5
            String label = this.labelGenerator.generateSectionLabel(
6
                    this.dataset, leftKeys.getKey(i));
6
                    this.dataset, keys.getKey(i));
7
            if (label != null) {
7
            if (label != null) {
8
                TextBlock block = TextUtilities.createTextBlock(label, 
8
                TextBlock block = TextUtilities.createTextBlock(label, 
9
                        this.labelFont, this.labelPaint, maxLabelWidth, 
9
                        this.labelFont, this.labelPaint, maxLabelWidth, 
10
                        new G2TextMeasurer(g2));
10
                        new G2TextMeasurer(g2));
11
                TextBox labelBox = new TextBox(block);
11
                TextBox labelBox = new TextBox(block);
12
                labelBox.setBackgroundPaint(this.labelBackgroundPaint);
12
                labelBox.setBackgroundPaint(this.labelBackgroundPaint);
13
                labelBox.setOutlinePaint(this.labelOutlinePaint);
13
                labelBox.setOutlinePaint(this.labelOutlinePaint);
14
                labelBox.setOutlineStroke(this.labelOutlineStroke);
14
                labelBox.setOutlineStroke(this.labelOutlineStroke);
15
                labelBox.setShadowPaint(this.labelShadowPaint);
15
                labelBox.setShadowPaint(this.labelShadowPaint);
16
                labelBox.setInteriorGap(this.labelPadding);
16
                labelBox.setInteriorGap(this.labelPadding);
17
                double theta = Math.toRadians(
17
                double theta = Math.toRadians(
18
                        leftKeys.getValue(i).doubleValue());
18
keys.getValue(i).doubleValue());
19
                double baseY = state.getPieCenterY() - Math.sin(theta) 
19
                double baseY = state.getPieCenterY() 
20
                               * verticalLinkRadius;
20
                              - Math.sin(theta) * verticalLinkRadius;
21
                double hh = labelBox.getHeight(g2);
21
                double hh = labelBox.getHeight(g2);
22
                this.labelDistributor.addPieLabelRecord(new PieLabelRecord(
22
                this.labelDistributor.addPieLabelRecord(new PieLabelRecord(
23
                        leftKeys.getKey(i), theta, baseY, labelBox, hh,
23
                        keys.getKey(i), theta, baseY, labelBox, hh,
24
                        lGap / 2.0 + lGap / 2.0 * -Math.cos(theta), 0.9 
24
                        lGap / 2.0 + lGap / 2.0 * Math.cos(theta), 
25
                        + getExplodePercent(leftKeys.getKey(i))));
25
                        0.9 + getExplodePercent(keys.getKey(i))));
26
            }
26
            }
27
        }
27
        }
28
        double hh = plotArea.getHeight();
28
        double hh = plotArea.getHeight();
29
        double gap = hh * getInteriorGap();
29
        double gap = hh * getInteriorGap();
30
        this.labelDistributor.distributeLabels(plotArea.getMinY() + gap, 
30
        this.labelDistributor.distributeLabels(plotArea.getMinY() + gap, 
31
                hh - 2 * gap);
31
                hh - 2 * gap);
32
        for (int i = 0; i < this.labelDistributor.getItemCount(); i++) {
32
        for (int i = 0; i < this.labelDistributor.getItemCount(); i++) {
33
            drawLeftLabel(g2, state, 
33
            drawRightLabel(g2, state, 
34
                    this.labelDistributor.getPieLabelRecord(i));
34
                    this.labelDistributor.getPieLabelRecord(i));
35
        }
35
        }
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.6
Clones locationClones are declared in the same class
Number of node comparisons190
  1. {Refactorable}
    Mapping Summary
    Number of mapped statements22
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)248.9
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    this.labelDistributor.clear();
    1
    this.labelDistributor.clear();
    2
    double lGap = plotArea.getWidth() * this.labelGap;
    2
    double lGap = plotArea.getWidth() * this.labelGap;
    3
    double verticalLinkRadius = state.getLinkArea().getHeight() / 2.0;
    3
    double verticalLinkRadius = state.getLinkArea().getHeight() / 2.0;
    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))));
    18
    double hh = plotArea.getHeight();
    18
    double hh = plotArea.getHeight();
    19
    double gap = hh * getInteriorGap();
    19
    double gap = hh * getInteriorGap();
    20
    this.labelDistributor.distributeLabels(plotArea.getMinY() + gap, hh - 2 * gap);
    20
    this.labelDistributor.distributeLabels(plotArea.getMinY() + gap, hh - 2 * gap);
    21
    for (int i = 0; i < this.labelDistributor.getItemCount(); i++)
    21
    for (int i = 0; i < this.labelDistributor.getItemCount(); i++)
    22
    drawLeftLabel(g2, state, this.labelDistributor.getPieLabelRecord(i));
    22
    drawLeftLabel(g2, state, this.labelDistributor.getPieLabelRecord(i));
    22
    drawRightLabel(g2, state, this.labelDistributor.getPieLabelRecord(i));
    Differences
    Expression1Expression2Difference
    drawLeftLabeldrawRightLabelMETHOD_INVOCATION_NAME_MISMATCH
    Preondition Violations
    Expression drawLeftLabel(g2,state,this.labelDistributor.getPieLabelRecord(i)) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression drawRightLabel(g2,state,this.labelDistributor.getPieLabelRecord(i)) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression drawLeftLabel(g2,state,this.labelDistributor.getPieLabelRecord(i)) is a void method call, and thus it cannot be parameterized
    Expression drawRightLabel(g2,state,this.labelDistributor.getPieLabelRecord(i)) is a void method call, and thus it cannot be parameterized
    22
    drawRightLabel(g2, state, this.labelDistributor.getPieLabelRecord(i));
    Precondition Violations (6)
    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
    3Expression drawLeftLabel(g2,state,this.labelDistributor.getPieLabelRecord(i)) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Expression drawRightLabel(g2,state,this.labelDistributor.getPieLabelRecord(i)) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5Expression drawLeftLabel(g2,state,this.labelDistributor.getPieLabelRecord(i)) is a void method call, and thus it cannot be parameterized
    6Expression drawRightLabel(g2,state,this.labelDistributor.getPieLabelRecord(i)) is a void method call, and thus it cannot be parameterized