double newMin; try { newMin = Double.parseDouble(this.minimumRangeValue.getText()); if (newMin >= this.maximumValue) { newMin = this.minimumValue; } } catch (NumberFormatException e) { newMin = this.minimumValue; } this.minimumValue = newMin; this.minimumRangeValue.setText(Double.toString(this.minimumValue));
double newMax; try { newMax = Double.parseDouble(this.maximumRangeValue.getText()); if (newMax <= this.minimumValue) { newMax = this.maximumValue; } } catch (NumberFormatException e) { newMax = this.maximumValue; } this.maximumValue = newMax; this.maximumRangeValue.setText(Double.toString(this.maximumValue));
Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/chart/editor/DefaultNumberAxisEditor.java File path: /jfreechart-1.0.10/src/org/jfree/chart/editor/DefaultNumberAxisEditor.java
Method name: void validateMinimum() Method name: void validateMaximum()
Number of AST nodes: 7 Number of AST nodes: 7
1
double newMin;
1
double newMax;
2
        try {
2
        try {
3
            newMin = Double.parseDouble(this.minimumRangeValue.getText());
3
            newMax = Double.parseDouble(this.maximumRangeValue.getText());
4
            if (newMin &gt;= this.maximumValue) {
4
            if (newMax &lt;= this.minimumValue) {
5
                newMin = this.minimumValue;
5
                newMax = this.maximumValue;
6
            }
6
            }
7
        }
7
        }
8
        catch (NumberFormatException e) {
8
        catch (NumberFormatException e) {
9
            newMin = this.minimumValue;
9
            newMax = this.maximumValue;
10
        }
10
        }
11
        this.minimumValue = newMin;
11
        this.maximumValue = newMax;
12
        this.minimumRangeValue.setText(Double.toString(this.minimumValue));
12
        this.maximumRangeValue.setText(Double.toString(this.maximumValue));
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.2
Clones locationClones are declared in the same class
Number of node comparisons10
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements5
    Number of unmapped statements in the first code fragment2
    Number of unmapped statements in the second code fragment2
    Time elapsed for statement mapping (ms)2.6
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    1
    double newMin;
    1
    double newMin;
    1
    double newMax;
    Differences
    Expression1Expression2Difference
    newMinnewMaxVARIABLE_NAME_MISMATCH
    1
    double newMax;
    2
    try
    2
    try
    2
    try
    Differences
    Expression1Expression2Difference
    newMinnewMaxVARIABLE_NAME_MISMATCH
    minimumValuemaximumValueVARIABLE_NAME_MISMATCH
    Preondition Violations
    Expression this.minimumValue cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression this.maximumValue cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2
    try
    3
    newMin = Double.parseDouble(this.minimumRangeValue.getText());
    3
    newMin = Double.parseDouble(this.minimumRangeValue.getText());
    3
    newMax = Double.parseDouble(this.maximumRangeValue.getText());
    Differences
    Expression1Expression2Difference
    newMinnewMaxVARIABLE_NAME_MISMATCH
    minimumRangeValuemaximumRangeValueVARIABLE_NAME_MISMATCH
    3
    newMax = Double.parseDouble(this.maximumRangeValue.getText());
                                                                        
    4
    if (newMax <= this.minimumValue)
    Preondition Violations
    Unmatched statement if(newMax <= this.minimumValue) cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4
    if (newMax <= this.minimumValue)
                                                            
    5
    newMax = this.maximumValue;
    Preondition Violations
    Unmatched statement newMax=this.maximumValue; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    5
    newMax = this.maximumValue;
    4
    if (newMin >= this.maximumValue)
    4
    if (newMin >= this.maximumValue)
    Preondition Violations
    Unmatched statement if(newMin >= this.maximumValue) cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                        
    5
    newMin = this.minimumValue;
    5
    newMin = this.minimumValue;
    Preondition Violations
    Unmatched statement newMin=this.minimumValue; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                            
    6
    this.minimumValue = newMin;
    6
    this.minimumValue = newMin;
    6
    this.maximumValue = newMax;
    Differences
    Expression1Expression2Difference
    minimumValuemaximumValueVARIABLE_NAME_MISMATCH
    newMinnewMaxVARIABLE_NAME_MISMATCH
    Preondition Violations
    Expression this.minimumValue is a field being modified, and thus it cannot be parameterized
    Expression this.maximumValue is a field being modified, and thus it cannot be parameterized
    6
    this.maximumValue = newMax;
    7
    this.minimumRangeValue.setText(Double.toString(this.minimumValue));
    7
    this.minimumRangeValue.setText(Double.toString(this.minimumValue));
    7
    this.maximumRangeValue.setText(Double.toString(this.maximumValue));
    Differences
    Expression1Expression2Difference
    minimumValuemaximumValueVARIABLE_NAME_MISMATCH
    minimumRangeValuemaximumRangeValueVARIABLE_NAME_MISMATCH
    Preondition Violations
    Expression this.minimumValue cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression this.maximumValue cannot be parameterized, because it has dependencies to/from statements that will be extracted
    7
    this.maximumRangeValue.setText(Double.toString(this.maximumValue));
    Precondition Violations (10)
    Row Violation
    1Expression this.minimumValue cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression this.maximumValue cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Unmatched statement if(newMax <= this.minimumValue) cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4Unmatched statement newMax=this.maximumValue; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    5Unmatched statement if(newMin >= this.maximumValue) cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    6Unmatched statement newMin=this.minimumValue; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    7Expression this.minimumValue is a field being modified, and thus it cannot be parameterized
    8Expression this.maximumValue is a field being modified, and thus it cannot be parameterized
    9Expression this.minimumValue cannot be parameterized, because it has dependencies to/from statements that will be extracted
    10Expression this.maximumValue cannot be parameterized, because it has dependencies to/from statements that will be extracted