while (tmpGC.textExtent(Az).x > DUMMY_PANEL.getFontMetrics(font).stringWidth(Az)) { tmpFont.dispose(); height--; fontData.setHeight(height); tmpFont = new Font(device, fontData); tmpGC.setFont(tmpFont); }
while (tmpGC.textExtent(Az).x < DUMMY_PANEL.getFontMetrics(font).stringWidth(Az)) { tmpFont.dispose(); height++; fontData.setHeight(height); tmpFont = new Font(device, fontData); tmpGC.setFont(tmpFont); }
Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/swt/org/jfree/experimental/swt/SWTUtils.java File path: /jfreechart-1.0.10/swt/org/jfree/experimental/swt/SWTUtils.java
Method name: FontData toSwtFontData(Device, java.awt.Font, boolean) Method name: FontData toSwtFontData(Device, java.awt.Font, boolean)
Number of AST nodes: 6 Number of AST nodes: 6
1
while (tmpGC.textExtent(Az).x 
1
while (tmpGC.textExtent(Az).x 
2
                        &gt; DUMMY_PANEL.getFontMetrics(font).stringWidth(Az)) {
2
                        &lt; DUMMY_PANEL.getFontMetrics(font).stringWidth(Az)) {
3
                    tmpFont.dispose();
3
                    tmpFont.dispose();
4
                    height--;
4
                    height++;
5
                    fontData.setHeight(height);
5
                    fontData.setHeight(height);
6
                    tmpFont = new Font(device, fontData);
6
                    tmpFont = new Font(device, fontData);
7
                    tmpGC.setFont(tmpFont);
7
                    tmpGC.setFont(tmpFont);
8
                }
8
                }
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.6
Clones locationClones are in the same method
Number of node comparisons37
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements5
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)4.4
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    25
    while (tmpGC.textExtent(Az).x > DUMMY_PANEL.getFontMetrics(font).stringWidth(Az))
    25
    while (tmpGC.textExtent(Az).x > DUMMY_PANEL.getFontMetrics(font).stringWidth(Az))
    32
    while (tmpGC.textExtent(Az).x < DUMMY_PANEL.getFontMetrics(font).stringWidth(Az))
    Differences
    Expression1Expression2Difference
    ><OPERATOR_MISMATCH
    32
    while (tmpGC.textExtent(Az).x < DUMMY_PANEL.getFontMetrics(font).stringWidth(Az))
    26
    tmpFont.dispose();
    33
    tmpFont.dispose();
    27
    height--;
    27
    height--;
    Preondition Violations
    Unmatched statement height--; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                              
                              
    34
    height++;
    Preondition Violations
    Unmatched statement height++; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    34
    height++;
    28
    fontData.setHeight(height);
    35
    fontData.setHeight(height);
    29
    tmpFont = new Font(device, fontData);
    36
    tmpFont = new Font(device, fontData);
    30
    tmpGC.setFont(tmpFont);
    37
    tmpGC.setFont(tmpFont);
    Precondition Violations (2)
    Row Violation
    1Unmatched statement height--; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    2Unmatched statement height++; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted