if (text == null) { throw new IllegalArgumentException("Null 'text' argument."); } if (!this.text.equals(text)) { this.text = text; notifyListeners(new TitleChangeEvent(this)); }
if (font == null) { throw new IllegalArgumentException("Null 'font' argument."); } if (!this.font.equals(font)) { this.font = font; notifyListeners(new TitleChangeEvent(this)); }
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: void setText(String) Method name: void setFont(Font)
Number of AST nodes: 5 Number of AST nodes: 5
1
if (text == null) {
1
if (font == null) {
2
            throw new IllegalArgumentException("Null 'text' argument.");
2
            throw new IllegalArgumentException("Null 'font' argument.");
3
        }
3
        }
4
        if (!this.text.equals(text)) {
4
        if (!this.font.equals(font)) {
5
            this.text = text;
5
            this.font = font;
6
            notifyListeners(new TitleChangeEvent(this));
6
            notifyListeners(new TitleChangeEvent(this));
7
        }
7
        }
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 comparisons15
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements4
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)8.0
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    if (text == null)
    1
    if (text == null)
    1
    if (font == null)
    Differences
    Expression1Expression2Difference
    textfontVARIABLE_NAME_MISMATCH
    java.lang.Stringjava.awt.FontVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.lang.String of variable text does not match with type java.awt.Font of variable font
    • Make classes java.lang.String and java.awt.Font extend a common superclass
    1
    if (font == null)
    2
    throw new IllegalArgumentException("Null 'text' argument.");
    2
    throw new IllegalArgumentException("Null 'text' argument.");
    2
    throw new IllegalArgumentException("Null 'font' argument.");
    Differences
    Expression1Expression2Difference
    "Null 'text' argument.""Null 'font' argument."LITERAL_VALUE_MISMATCH
    2
    throw new IllegalArgumentException("Null 'font' argument.");
    3
    if (!this.text.equals(text))
    3
    if (!this.text.equals(text))
    3
    if (!this.font.equals(font))
    Differences
    Expression1Expression2Difference
    textfontVARIABLE_NAME_MISMATCH
    java.lang.Stringjava.awt.FontVARIABLE_TYPE_MISMATCH
    textfontVARIABLE_NAME_MISMATCH
    java.lang.Stringjava.awt.FontVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.lang.String of variable text does not match with type java.awt.Font of variable font
    • Make classes java.lang.String and java.awt.Font extend a common superclass
    Type java.lang.String of variable this.text does not match with type java.awt.Font of variable this.font
    • Make classes java.lang.String and java.awt.Font extend a common superclass
    3
    if (!this.font.equals(font))
                                        
    4
    this.font = font;
    Preondition Violations
    Unmatched statement this.font=font; cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    4
    this.font = font;
    4
    this.text = text;
    4
    this.text = text;
    Preondition Violations
    Unmatched statement this.text=text; cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
                                        
    5
    notifyListeners(new TitleChangeEvent(this));
    5
    notifyListeners(new TitleChangeEvent(this));
    Precondition Violations (5)
    Row Violation
    1Type java.lang.String of variable text does not match with type java.awt.Font of variable font
    2Type java.lang.String of variable text does not match with type java.awt.Font of variable font
    3Type java.lang.String of variable this.text does not match with type java.awt.Font of variable this.font
    4Unmatched statement this.font=font; cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    5Unmatched statement this.text=text; cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted