XYSeries s1 = new XYSeries("S1"); s1.add(1.0, 1.1); s1.add(2.0, null); s1.add(3.0, 3.3); XYSeriesCollection dataset = new XYSeriesCollection(s1); Range r = DatasetUtilities.iterateRangeBounds(dataset); assertEquals(1.1, r.getLowerBound(), EPSILON); assertEquals(3.3, r.getUpperBound(), EPSILON);
List values = new ArrayList(); values.add(new Double(1.0)); values.add(new Double(2.0)); values.add(new Double(3.0)); values.add(new Double(6.0)); values.add(new Double(5.0)); values.add(new Double(4.0)); double median = Statistics.calculateMedian(values); assertEquals(3.5, median, 0.0000001);
Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/tests/org/jfree/data/general/junit/DatasetUtilitiesTests.java File path: /jfreechart-1.0.10/tests/org/jfree/data/statistics/junit/StatisticsTests.java
Method name: void testIterateRangeBounds2() Method name: void testCalculateMedian3()
Number of AST nodes: 8 Number of AST nodes: 9
1
XYSeries s1 = new XYSeries("S1");
1
List values = new ArrayList();
2
        s1.add(1.0, 1.1);
2
        values.add(new Double(1.0));
3
        s1.add(2.0, null);
3
        values.add(new Double(2.0));
4
        s1.add(3.0, 3.3);
4
        
5
        XYSeriesCollection dataset = new XYSeriesCollection(s1);
6
        Range r = DatasetUtilities.iterateRangeBounds(dataset);
7
        assertEquals(1.1, r.getLowerBound(), EPSILON
5
values.add(new Double(3.0));
6
        values.add(new Double(6.0));
7
        values.add(new Double(5.0));
8
        values.add(new Double(4.0));
8
);
9
        double median = Statistics.calculateMedian(values);
9
        assertEquals(3.3, r.getUpperBound(), EPSILON);
10
        assertEquals(3.5, median, 0.0000001);
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.0
Clones locationClones are in different classes having the same super class
Number of node comparisons72
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements1
    Number of unmapped statements in the first code fragment7
    Number of unmapped statements in the second code fragment8
    Time elapsed for statement mapping (ms)0.0
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
                                                                  
    1
    List values = new ArrayList();
    Preondition Violations
    Unmatched statement List values=new ArrayList(); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    1
    List values = new ArrayList();
    1
    XYSeries s1 = new XYSeries("S1");
    1
    XYSeries s1 = new XYSeries("S1");
    Preondition Violations
    Unmatched statement XYSeries s1=new XYSeries("S1"); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
                                                                        
                                                                  
    2
    values.add(new Double(1.0));
    Preondition Violations
    Unmatched statement values.add(new Double(1.0)); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    2
    values.add(new Double(1.0));
    2
    s1.add(1.0, 1.1);
    2
    s1.add(1.0, 1.1);
    Preondition Violations
    Unmatched statement s1.add(1.0,1.1); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
                                          
                                                                  
    3
    values.add(new Double(2.0));
    Preondition Violations
    Unmatched statement values.add(new Double(2.0)); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    3
    values.add(new Double(2.0));
    3
    s1.add(2.0, null);
    3
    s1.add(2.0, null);
    Preondition Violations
    Unmatched statement s1.add(2.0,null); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
                                            
                                                                  
    4
    values.add(new Double(3.0));
    Preondition Violations
    Unmatched statement values.add(new Double(3.0)); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    4
    values.add(new Double(3.0));
    4
    s1.add(3.0, 3.3);
    4
    s1.add(3.0, 3.3);
    Preondition Violations
    Unmatched statement s1.add(3.0,3.3); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
                                          
                                                                  
    5
    values.add(new Double(6.0));
    Preondition Violations
    Unmatched statement values.add(new Double(6.0)); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    5
    values.add(new Double(6.0));
    5
    XYSeriesCollection dataset = new XYSeriesCollection(s1);
    5
    XYSeriesCollection dataset = new XYSeriesCollection(s1);
    Preondition Violations
    Unmatched statement XYSeriesCollection dataset=new XYSeriesCollection(s1); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
                                                                                                                      
                                                                  
    6
    values.add(new Double(5.0));
    Preondition Violations
    Unmatched statement values.add(new Double(5.0)); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    6
    values.add(new Double(5.0));
    6
    Range r = DatasetUtilities.iterateRangeBounds(dataset);
                                                                                                                    
                                                                  
    7
    values.add(new Double(4.0));
    Preondition Violations
    Unmatched statement values.add(new Double(4.0)); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    7
    values.add(new Double(4.0));
                                                                                                            
    8
    double median = Statistics.calculateMedian(values);
    7
    assertEquals(1.1, r.getLowerBound(), EPSILON);
    7
    assertEquals(1.1, r.getLowerBound(), EPSILON);
    9
    assertEquals(3.5, median, 0.0000001);
    Differences
    Expression1Expression2Difference
    1.13.5LITERAL_VALUE_MISMATCH
    r.getLowerBound()medianTYPE_COMPATIBLE_REPLACEMENT
    EPSILON0.0000001TYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression r.getLowerBound() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression median cannot be parameterized, because it has dependencies to/from statements that will be extracted
    9
    assertEquals(3.5, median, 0.0000001);
    8
    assertEquals(3.3, r.getUpperBound(), EPSILON);
                                                                                                  
    Precondition Violations (14)
    Row Violation
    1Unmatched statement List values=new ArrayList(); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    2Unmatched statement XYSeries s1=new XYSeries("S1"); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    3Unmatched statement values.add(new Double(1.0)); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    4Unmatched statement s1.add(1.0,1.1); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    5Unmatched statement values.add(new Double(2.0)); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    6Unmatched statement s1.add(2.0,null); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    7Unmatched statement values.add(new Double(3.0)); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    8Unmatched statement s1.add(3.0,3.3); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    9Unmatched statement values.add(new Double(6.0)); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    10Unmatched statement XYSeriesCollection dataset=new XYSeriesCollection(s1); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    11Unmatched statement values.add(new Double(5.0)); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    12Unmatched statement values.add(new Double(4.0)); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    13Expression r.getLowerBound() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    14Expression median cannot be parameterized, because it has dependencies to/from statements that will be extracted