if (position == RectangleEdge.LEFT || position == RectangleEdge.RIGHT) { float maxWidth = Float.MAX_VALUE; g2.setFont(this.font); this.content = TextUtilities.createTextBlock(this.text, this.font, this.paint, maxWidth, this.maximumLinesToDisplay, new G2TextMeasurer(g2)); this.content.setLineAlignment(this.textAlignment); Size2D contentSize = this.content.calculateDimensions(g2); // transpose the dimensions, because the title is rotated if (this.expandToFitSpace) { return new Size2D(contentSize.getHeight(), maxWidth); } else { return new Size2D(contentSize.height, contentSize.width); } } else { throw new RuntimeException("Unrecognised exception."); }
if (position == RectangleEdge.LEFT || position == RectangleEdge.RIGHT) { float maxWidth = (float) heightRange.getUpperBound(); g2.setFont(this.font); this.content = TextUtilities.createTextBlock(this.text, this.font, this.paint, maxWidth, this.maximumLinesToDisplay, new G2TextMeasurer(g2)); this.content.setLineAlignment(this.textAlignment); Size2D contentSize = this.content.calculateDimensions(g2); // transpose the dimensions, because the title is rotated if (this.expandToFitSpace) { return new Size2D(contentSize.getHeight(), maxWidth); } else { return new Size2D(contentSize.height, contentSize.width); } } else { throw new RuntimeException("Unrecognised exception."); }
Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/chart/title/TextTitle.java File path: /jfreechart-1.0.10/src/org/jfree/chart/title/TextTitle.java
Method name: Size2D arrangeFN(Graphics2D, double) Method name: Size2D arrangeRR(Graphics2D, Range, Range)
Number of AST nodes: 10 Number of AST nodes: 10
1
if (position == RectangleEdge.LEFT || position
1
if (position == RectangleEdge.LEFT || position
2
                == RectangleEdge.RIGHT) {
2
                == RectangleEdge.RIGHT) {
3
            float maxWidth = Float.MAX_VALUE;
3
            float maxWidth = (float) heightRange.getUpperBound();
4
            g2.setFont(this.font);
4
            g2.setFont(this.font);
5
            this.content = TextUtilities.createTextBlock(this.text, this.font,
5
            this.content = TextUtilities.createTextBlock(this.text, this.font,
6
                    this.paint, maxWidth, this.maximumLinesToDisplay,
6
                    this.paint, maxWidth, this.maximumLinesToDisplay,
7
                    new G2TextMeasurer(g2));
7
                    new G2TextMeasurer(g2));
8
            this.content.setLineAlignment(this.textAlignment);
8
            this.content.setLineAlignment(this.textAlignment);
9
            Size2D contentSize = this.content.calculateDimensions(g2);
9
            Size2D contentSize = this.content.calculateDimensions(g2);
10
            // transpose the dimensions, because the title is rotated
10
            // transpose the dimensions, because the title is rotated
11
            if (this.expandToFitSpace) {
11
            if (this.expandToFitSpace) {
12
                return new Size2D(contentSize.getHeight(), maxWidth);
12
                return new Size2D(contentSize.getHeight(), maxWidth);
13
            }
13
            }
14
            else {
14
            else {
15
                return new Size2D(contentSize.height, contentSize.width);
15
                return new Size2D(contentSize.height, contentSize.width);
16
            }
16
            }
17
        }
17
        }
18
        else {
18
        else {
19
            throw new RuntimeException("Unrecognised exception.");
19
            throw new RuntimeException("Unrecognised exception.");
20
        }
20
        }
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.3
Clones locationClones are declared in the same class
Number of node comparisons58
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements10
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)7.7
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    11
    else if (position == RectangleEdge.LEFT || position == RectangleEdge.RIGHT)
    11
    else if (position == RectangleEdge.LEFT || position == RectangleEdge.RIGHT)
    12
    float maxWidth = Float.MAX_VALUE;
    12
    float maxWidth = Float.MAX_VALUE;
    12
    float maxWidth = (float)heightRange.getUpperBound();
    Differences
    Expression1Expression2Difference
    Float.MAX_VALUE(float)heightRange.getUpperBound()TYPE_COMPATIBLE_REPLACEMENT
    12
    float maxWidth = (float)heightRange.getUpperBound();
    13
    g2.setFont(this.font);
    13
    g2.setFont(this.font);
    14
    this.content = TextUtilities.createTextBlock(this.text, this.font, this.paint, maxWidth, this.maximumLinesToDisplay, new G2TextMeasurer(g2));
    14
    this.content = TextUtilities.createTextBlock(this.text, this.font, this.paint, maxWidth, this.maximumLinesToDisplay, new G2TextMeasurer(g2));
    15
    this.content.setLineAlignment(this.textAlignment);
    15
    this.content.setLineAlignment(this.textAlignment);
    16
    Size2D contentSize = this.content.calculateDimensions(g2);
    16
    Size2D contentSize = this.content.calculateDimensions(g2);
    17
    if (this.expandToFitSpace)
    17
    if (this.expandToFitSpace)
    18
    return new Size2D(contentSize.getHeight(), maxWidth);
    18
    return new Size2D(contentSize.getHeight(), maxWidth);
    else
    else
    19
    return new Size2D(contentSize.height, contentSize.width);
    19
    return new Size2D(contentSize.height, contentSize.width);
    else
    else
    20
    throw new RuntimeException("Unrecognised exception.");
    20
    throw new RuntimeException("Unrecognised exception.");
    Precondition Violations (1)
    Row Violation
    1Not all possible execution flows end in a return statement