if (dataset == null) { throw new IllegalArgumentException("Null 'dataset' argument."); } Range result = null; // if the dataset implements DomainInfo, life is easier if (dataset instanceof DomainInfo) { DomainInfo info = (DomainInfo) dataset; result = info.getDomainBounds(includeInterval); } else { result = iterateDomainBounds(dataset, includeInterval); } return result;
if (dataset == null) { throw new IllegalArgumentException("Null 'dataset' argument."); } Range result = null; if (dataset instanceof RangeInfo) { RangeInfo info = (RangeInfo) dataset; result = info.getRangeBounds(includeInterval); } else { result = iterateRangeBounds(dataset, includeInterval); } return result;
Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/data/general/DatasetUtilities.java File path: /jfreechart-1.0.10/src/org/jfree/data/general/DatasetUtilities.java
Method name: Range findDomainBounds(XYDataset, boolean) Method name: Range findRangeBounds(XYDataset, boolean)
Number of AST nodes: 8 Number of AST nodes: 8
1
if (dataset == null) {
1
if (dataset == null) {
2
            throw new IllegalArgumentException("Null 'dataset' argument.");
2
            throw new IllegalArgumentException("Null 'dataset' argument.");
3
        }
3
        }
4
        Range result = null;
4
        Range result = null;
5
        // if the dataset implements DomainInfo, life is easier
6
        if (dataset instanceof DomainInfo) {
5
        if (dataset instanceof RangeInfo) {
7
            DomainInfo info = (DomainInfo) dataset;
6
            RangeInfo info = (RangeInfo) dataset;
8
            result = info.getDomainBounds(includeInterval);
7
            result = info.getRangeBounds(includeInterval);
9
        }
8
        }
10
        else {
9
        else {
11
            result = iterateDomainBounds(dataset, includeInterval);
10
            result = iterateRangeBounds(dataset, includeInterval);
12
        }
11
        }
13
        return result;
12
        return result;
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 comparisons26
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements7
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)791.1
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    if (dataset == null)
    1
    if (dataset == null)
    2
    throw new IllegalArgumentException("Null 'dataset' argument.");
    2
    throw new IllegalArgumentException("Null 'dataset' argument.");
    3
    Range result = null;
    3
    Range result = null;
    4
    if (dataset instanceof DomainInfo)
    4
    if (dataset instanceof DomainInfo)
    4
    if (dataset instanceof RangeInfo)
    Differences
    Expression1Expression2Difference
    org.jfree.data.DomainInfoorg.jfree.data.RangeInfoVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Expression dataset instanceof DomainInfo cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression dataset instanceof RangeInfo cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Type org.jfree.data.DomainInfo does not match with type org.jfree.data.RangeInfo
    • Make classes org.jfree.data.DomainInfo and org.jfree.data.RangeInfo extend a common superclass
    4
    if (dataset instanceof RangeInfo)
                                                                              
    5
    RangeInfo info = (RangeInfo)dataset;
    Preondition Violations
    Unmatched statement RangeInfo info=(RangeInfo)dataset; cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    5
    RangeInfo info = (RangeInfo)dataset;
    5
    DomainInfo info = (DomainInfo)dataset;
    5
    DomainInfo info = (DomainInfo)dataset;
    Preondition Violations
    Unmatched statement DomainInfo info=(DomainInfo)dataset; cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
                                                                                  
    6
    result = info.getDomainBounds(includeInterval);
    6
    result = info.getDomainBounds(includeInterval);
    6
    result = info.getRangeBounds(includeInterval);
    Differences
    Expression1Expression2Difference
    getDomainBoundsgetRangeBoundsMETHOD_INVOCATION_NAME_MISMATCH
    org.jfree.data.DomainInfoorg.jfree.data.RangeInfoVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Expression info.getDomainBounds(includeInterval) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression info.getRangeBounds(includeInterval) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Type org.jfree.data.DomainInfo of variable info does not match with type org.jfree.data.RangeInfo of variable info
    • Make classes org.jfree.data.DomainInfo and org.jfree.data.RangeInfo extend a common superclass
    6
    result = info.getRangeBounds(includeInterval);
    else
    else
    7
    result = iterateDomainBounds(dataset, includeInterval);
    7
    result = iterateDomainBounds(dataset, includeInterval);
    7
    result = iterateRangeBounds(dataset, includeInterval);
    Differences
    Expression1Expression2Difference
    iterateDomainBoundsiterateRangeBoundsMETHOD_INVOCATION_NAME_MISMATCH
    Preondition Violations
    Expression iterateDomainBounds(dataset,includeInterval) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression iterateRangeBounds(dataset,includeInterval) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    7
    result = iterateRangeBounds(dataset, includeInterval);
    8
    return result;
    8
    return result;
    Precondition Violations (10)
    Row Violation
    1Expression dataset instanceof DomainInfo cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression dataset instanceof RangeInfo cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Type org.jfree.data.DomainInfo does not match with type org.jfree.data.RangeInfo
    4Unmatched statement RangeInfo info=(RangeInfo)dataset; cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    5Unmatched statement DomainInfo info=(DomainInfo)dataset; cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    6Expression info.getDomainBounds(includeInterval) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    7Expression info.getRangeBounds(includeInterval) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    8Type org.jfree.data.DomainInfo of variable info does not match with type org.jfree.data.RangeInfo of variable info
    9Expression iterateDomainBounds(dataset,includeInterval) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    10Expression iterateRangeBounds(dataset,includeInterval) cannot be parameterized, because it has dependencies to/from statements that will be extracted