if (isInternalAnchor(position.getItemLabelAnchor())) { Shape bounds = TextUtilities.calculateRotatedStringBounds(label, g2, (float) anchorPoint.getX(), (float) anchorPoint.getY(), position.getTextAnchor(), position.getAngle(), position.getRotationAnchor()); if (bounds != null) { if (!bar.contains(bounds.getBounds2D())) { if (!negative) { position = getPositiveItemLabelPositionFallback(); } else { position = getNegativeItemLabelPositionFallback(); } if (position != null) { anchorPoint = calculateLabelAnchorPoint( position.getItemLabelAnchor(), bar, plot.getOrientation()); } } } }
if (isInternalAnchor(position.getItemLabelAnchor())) { Shape bounds = TextUtilities.calculateRotatedStringBounds(label, g2, (float) anchorPoint.getX(), (float) anchorPoint.getY(), position.getTextAnchor(), position.getAngle(), position.getRotationAnchor()); if (bounds != null) { if (!bar.contains(bounds.getBounds2D())) { if (!negative) { position = getPositiveItemLabelPositionFallback(); } else { position = getNegativeItemLabelPositionFallback(); } if (position != null) { anchorPoint = calculateLabelAnchorPoint( position.getItemLabelAnchor(), bar, plot.getOrientation()); } } } }
Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/chart/renderer/category/BarRenderer.java File path: /jfreechart-1.0.10/src/org/jfree/chart/renderer/xy/XYBarRenderer.java
Method name: void drawItemLabel(Graphics2D, CategoryDataset, int, int, CategoryPlot, CategoryItemLabelGenerator, Rectangle2D, boolean) Method name: void drawItemLabel(Graphics2D, XYDataset, int, int, XYPlot, XYItemLabelGenerator, Rectangle2D, boolean)
Number of AST nodes: 9 Number of AST nodes: 9
1
if (isInternalAnchor(position.getItemLabelAnchor())) {
1
if (isInternalAnchor(position.getItemLabelAnchor())) {
2
            Shape bounds = TextUtilities.calculateRotatedStringBounds(label,
2
            Shape bounds = TextUtilities.calculateRotatedStringBounds(label, 
3
                    g2, (float) anchorPoint.getX(), (float) anchorPoint.getY(),
3
                    g2, (float) anchorPoint.getX(), (float) anchorPoint.getY(),
4
                    position.getTextAnchor(), position.getAngle(),
4
                    position.getTextAnchor(), position.getAngle(),
5
                    position.getRotationAnchor());
5
                    position.getRotationAnchor());
6
            
6
            if (bounds != null) {
7
            if (bounds != null) {
7
                if (!bar.contains(bounds.getBounds2D())) {
8
                if (!bar.contains(bounds.getBounds2D())) {
8
                    if (!negative) {
9
                    if (!negative) {
9
                        position = getPositiveItemLabelPositionFallback();
10
                        position = getPositiveItemLabelPositionFallback();
10
                    }
11
                    }
11
                    else {
12
                    else {
12
                        position = getNegativeItemLabelPositionFallback();
13
                        position = getNegativeItemLabelPositionFallback();
13
                    }
14
                    }
14
                    if (position != null) {
15
                    if (position != null) {
15
                        anchorPoint = calculateLabelAnchorPoint(
16
                        anchorPoint = calculateLabelAnchorPoint(
16
                                position.getItemLabelAnchor(), bar,
17
                                position.getItemLabelAnchor(), bar, 
17
                                plot.getOrientation());
18
                                plot.getOrientation());
18
                    }
19
                    }
19
                }
20
                }
20
            }
21
            }
22
        
21
        }
23
        }
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)0.4
Clones locationClones are in different classes having the same super class
Number of node comparisons26
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements9
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)4.1
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    13
    if (isInternalAnchor(position.getItemLabelAnchor()))
    15
    if (isInternalAnchor(position.getItemLabelAnchor()))
    14
    Shape bounds = TextUtilities.calculateRotatedStringBounds(label, g2, (float)anchorPoint.getX(), (float)anchorPoint.getY(), position.getTextAnchor(), position.getAngle(), position.getRotationAnchor());
    16
    Shape bounds = TextUtilities.calculateRotatedStringBounds(label, g2, (float)anchorPoint.getX(), (float)anchorPoint.getY(), position.getTextAnchor(), position.getAngle(), position.getRotationAnchor());
    15
    if (bounds != null)
    17
    if (bounds != null)
    16
    if (!bar.contains(bounds.getBounds2D()))
    18
    if (!bar.contains(bounds.getBounds2D()))
    17
    if (!negative)
    19
    if (!negative)
    18
    position = getPositiveItemLabelPositionFallback();
    20
    position = getPositiveItemLabelPositionFallback();
    else
    else
    19
    position = getNegativeItemLabelPositionFallback();
    21
    position = getNegativeItemLabelPositionFallback();
    20
    if (position != null)
    22
    if (position != null)
    21
    anchorPoint = calculateLabelAnchorPoint(position.getItemLabelAnchor(), bar, plot.getOrientation());
    21
    anchorPoint = calculateLabelAnchorPoint(position.getItemLabelAnchor(), bar, plot.getOrientation());
    23
    anchorPoint = calculateLabelAnchorPoint(position.getItemLabelAnchor(), bar, plot.getOrientation());
    Differences
    Expression1Expression2Difference
    org.jfree.chart.plot.CategoryPlotorg.jfree.chart.plot.XYPlotSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression plot cannot be unified with expression plot , because common superclass org.jfree.chart.plot.Plot does not declare member(s) public org.jfree.chart.plot.PlotOrientation getOrientation()
    23
    anchorPoint = calculateLabelAnchorPoint(position.getItemLabelAnchor(), bar, plot.getOrientation());
    Precondition Violations (2)
    Row Violation
    1Expression plot cannot be unified with expression plot , because common superclass org.jfree.chart.plot.Plot does not declare member(s) public org.jfree.chart.plot.PlotOrientation getOrientation()
    2Clone fragment #1 returns variables position, anchorPoint , while Clone fragment #2 returns variables position, anchorPoint