Block b = (Block) iterator.next(); Size2D s = b.arrange(g2, RectangleConstraint.NONE); maxW = Math.max(maxW, s.width); maxH = Math.max(maxH, s.height);
String msg = (String) it.next(); FontMetrics fm = g2.getFontMetrics(); Rectangle2D bounds = TextUtilities.getTextBounds(msg, g2, fm); width = Math.max(width, bounds.getWidth()); height += bounds.getHeight();
Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/chart/block/GridArrangement.java File path: /jfreechart-1.0.10/src/org/jfree/chart/plot/PolarPlot.java
Method name: Size2D arrangeNN(BlockContainer, Graphics2D) Method name: void drawCornerTextItems(Graphics2D, Rectangle2D)
Number of AST nodes: 4 Number of AST nodes: 5
1
Block b = (Block) iterator.next();
2
            Size2D s = b.arrange(g2, RectangleConstraint.NONE
1
String msg = (String) it.next();
2
            FontMetrics fm = g2.getFontMetrics();
3
);
3
            Rectangle2D bounds = TextUtilities.getTextBounds(msg, g2, fm);
4
            maxW = Math.max(maxW, s.width);
4
            width = Math.max(width, bounds.getWidth());
5
            maxH = Math.max(maxH, s.height);
5
            height += bounds.getHeight();
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.0
Clones locationClones are in different classes
Number of node comparisons21
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements1
    Number of unmapped statements in the first code fragment3
    Number of unmapped statements in the second code fragment4
    Time elapsed for statement mapping (ms)0.0
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    6
    Block b = (Block)iterator.next();
    6
    Block b = (Block)iterator.next();
    Preondition Violations
    Unmatched statement Block b=(Block)iterator.next(); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
                                                                        
                                                                    
    7
    String msg = (String)it.next();
    Preondition Violations
    Unmatched statement String msg=(String)it.next(); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    7
    String msg = (String)it.next();
    7
    Size2D s = b.arrange(g2, RectangleConstraint.NONE);
    7
    Size2D s = b.arrange(g2, RectangleConstraint.NONE);
    Preondition Violations
    Unmatched statement Size2D s=b.arrange(g2,RectangleConstraint.NONE); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                                          
                                                                                
    8
    FontMetrics fm = g2.getFontMetrics();
                                                                                                                              
    9
    Rectangle2D bounds = TextUtilities.getTextBounds(msg, g2, fm);
    Preondition Violations
    Unmatched statement Rectangle2D bounds=TextUtilities.getTextBounds(msg,g2,fm); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    9
    Rectangle2D bounds = TextUtilities.getTextBounds(msg, g2, fm);
    8
    maxW = Math.max(maxW, s.width);
    8
    maxW = Math.max(maxW, s.width);
    10
    width = Math.max(width, bounds.getWidth());
    Differences
    Expression1Expression2Difference
    maxWwidthVARIABLE_NAME_MISMATCH
    maxWwidthVARIABLE_NAME_MISMATCH
    s.widthbounds.getWidth()TYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression s.width cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression bounds.getWidth() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    10
    width = Math.max(width, bounds.getWidth());
    9
    maxH = Math.max(maxH, s.height);
                                                                    
                                                                  
    11
    height += bounds.getHeight();
    Precondition Violations (6)
    Row Violation
    1Unmatched statement Block b=(Block)iterator.next(); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    2Unmatched statement String msg=(String)it.next(); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    3Unmatched statement Size2D s=b.arrange(g2,RectangleConstraint.NONE); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4Unmatched statement Rectangle2D bounds=TextUtilities.getTextBounds(msg,g2,fm); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    5Expression s.width cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6Expression bounds.getWidth() cannot be parameterized, because it has dependencies to/from statements that will be extracted