1619-2-3

DefaultKeyedValues2D d = new DefaultKeyedValues2D(); assertEquals(0, d.getColumnCount()); d.addValue(new Double(1.0), "R1", "C1"); assertEquals(1, d.getColumnCount()); d.addValue(new Double(2.0), "R1", "C2"); assertEquals(2, d.getColumnCount());
SimpleHistogramDataset d1 = new SimpleHistogramDataset("D1"); d1.clearObservations(); assertEquals(0, d1.getItemCount(0)); d1.addBin(new SimpleHistogramBin(0.0, 1.0)); d1.addObservation(0.5); assertEquals(1.0, d1.getYValue(0, 0), EPSILON);

Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/tests/org/jfree/data/junit/DefaultKeyedValues2DTests.java |  | File path: /jfreechart-1.0.10/tests/org/jfree/data/statistics/junit/SimpleHistogramDatasetTests.java
Method name: `void testColumnCount()` |  | Method name: `void testClearObservations()`
Number of AST nodes: 6 |  | Number of AST nodes: 6

1

    DefaultKeyedValues2D d = new DefaultKeyedValues2D↵

1

    SimpleHistogramDataset d1 = new SimpleHistogramDataset("D1");↵

2

    ();↵

2

            d1.clearObservations();↵

3

            assertEquals(0, d.getColumnCount());↵

3

            assertEquals(0, d1.getItemCount(0));↵

4

            d.addValue(new Double(1.0), "R1", "C1");↵

4

            d1.add↵

5

            assertEquals(1, d.getColumnCount());↵

5

    Bin(new SimpleHistogramBin(0.0, 1.0));↵

6

            d.addValue(new Double(2.0), "R1", "C2");↵

6

            d1.addObservation(0.5);↵

7

            assertEquals(2, d.getColumnCount());

7

            assertEquals(1.0, d1.getYValue(0, 0), EPSILON);

See real code fragment |  | See real code fragment

Summary
Number of common nesting structure subtrees | 1
Number of refactorable cases | 0
Number of non-refactorable cases | 1
Time elapsed for finding largest common nesting structure subtrees (ms) | 0.0
Clones location | Clones are in different classes having the same super class
Number of node comparisons | 36

1. {Non-refactorable}

   Mapping Summary
   Number of mapped statements | 4
   Number of unmapped statements in the first code fragment | 2
   Number of unmapped statements in the second code fragment | 2
   Time elapsed for statement mapping (ms) | 0.0
   Clone type | Type 2

   Mapped Statements
   ID | Statement |  | ID | Statement
   --- | --- | --- | --- | ---

   1

       SimpleHistogramDataset d1 = new SimpleHistogramDataset("D1");

   1

       DefaultKeyedValues2D d = new DefaultKeyedValues2D();

   2

       d1.clearObservations();

   2

       assertEquals(0, d.getColumnCount());

   2 | assertEquals(0, d.getColumnCount());
   6 | assertEquals(1.0, d1.getYValue(0, 0), EPSILON);

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   assertEquals(0,d.getColumnCount()) | assertEquals(1.0,d1.getYValue(0,0),EPSILON) | ARGUMENT_NUMBER_MISMATCH

   Preondition Violations
   Expression assertEquals(1.0,d1.getYValue(0,0),EPSILON) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   Expression assertEquals(0,d.getColumnCount()) is a void method call, and thus it cannot be parameterized
   Expression assertEquals(1.0,d1.getYValue(0,0),EPSILON) is a void method call, and thus it cannot be parameterized

   6

       assertEquals(1.0, d1.getYValue(0, 0), EPSILON);

   3

       d.addValue(new Double(1.0), "R1", "C1");

   3 | d.addValue(new Double(1.0), "R1", "C1");
   3 | assertEquals(0, d1.getItemCount(0));

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   addValue | assertEquals | METHOD_INVOCATION_NAME_MISMATCH
   d.addValue(new Double(1.0),"R1","C1") | assertEquals(0,d1.getItemCount(0)) | ARGUMENT_NUMBER_MISMATCH
   d |  | MISSING_METHOD_INVOCATION_EXPRESSION

   Preondition Violations
   Expression d.addValue(new Double(1.0),"R1","C1") cannot be parameterized, because it has dependencies to/from statements that will be extracted
   Expression d.addValue(new Double(1.0),"R1","C1") is a void method call, and thus it cannot be parameterized
   Expression assertEquals(0,d1.getItemCount(0)) is a void method call, and thus it cannot be parameterized
   Expression d.addValue(new Double(1.0),"R1","C1") cannot be parameterized, because it has dependencies to/from statements that will be extracted
   Expression d.addValue(new Double(1.0),"R1","C1") is a void method call, and thus it cannot be parameterized
   Expression assertEquals(0,d1.getItemCount(0)) is a void method call, and thus it cannot be parameterized

   3

       assertEquals(0, d1.getItemCount(0));

   4

       assertEquals(1, d.getColumnCount());

   4 | assertEquals(1, d.getColumnCount());
   4 | d1.addBin(new SimpleHistogramBin(0.0, 1.0));

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   assertEquals | addBin | METHOD_INVOCATION_NAME_MISMATCH
   assertEquals(1,d.getColumnCount()) | d1.addBin(new SimpleHistogramBin(0.0,1.0)) | ARGUMENT_NUMBER_MISMATCH
   | d1 | MISSING_METHOD_INVOCATION_EXPRESSION

   Preondition Violations
   Expression assertEquals(1,d.getColumnCount()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   Expression d1.addBin(new SimpleHistogramBin(0.0,1.0)) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   Expression assertEquals(1,d.getColumnCount()) is a void method call, and thus it cannot be parameterized
   Expression d1.addBin(new SimpleHistogramBin(0.0,1.0)) is a void method call, and thus it cannot be parameterized
   Expression assertEquals(1,d.getColumnCount()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   Expression d1.addBin(new SimpleHistogramBin(0.0,1.0)) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   Expression assertEquals(1,d.getColumnCount()) is a void method call, and thus it cannot be parameterized
   Expression d1.addBin(new SimpleHistogramBin(0.0,1.0)) is a void method call, and thus it cannot be parameterized

   4

       d1.addBin(new SimpleHistogramBin(0.0, 1.0));

   5

       d.addValue(new Double(2.0), "R1", "C2");

   5 | d.addValue(new Double(2.0), "R1", "C2");

   Preondition Violations
   Unmatched statement d.addValue(new Double(2.0),"R1","C2"); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted

   6

       assertEquals(2, d.getColumnCount());

   6 | assertEquals(2, d.getColumnCount());
   5 | d1.addObservation(0.5);

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   assertEquals | addObservation | METHOD_INVOCATION_NAME_MISMATCH
   assertEquals(2,d.getColumnCount()) | d1.addObservation(0.5) | ARGUMENT_NUMBER_MISMATCH
   | d1 | MISSING_METHOD_INVOCATION_EXPRESSION

   Preondition Violations
   Expression assertEquals(2,d.getColumnCount()) is a void method call, and thus it cannot be parameterized
   Expression d1.addObservation(0.5) is a void method call, and thus it cannot be parameterized
   Expression assertEquals(2,d.getColumnCount()) is a void method call, and thus it cannot be parameterized
   Expression d1.addObservation(0.5) is a void method call, and thus it cannot be parameterized

   5

       d1.addObservation(0.5);

   Precondition Violations (22)
   Row | Violation
   --- | ---
   1 | Expression assertEquals(1.0,d1.getYValue(0,0),EPSILON) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   2 | Expression assertEquals(0,d.getColumnCount()) is a void method call, and thus it cannot be parameterized
   3 | Expression assertEquals(1.0,d1.getYValue(0,0),EPSILON) is a void method call, and thus it cannot be parameterized
   4 | Expression d.addValue(new Double(1.0),"R1","C1") cannot be parameterized, because it has dependencies to/from statements that will be extracted
   5 | Expression d.addValue(new Double(1.0),"R1","C1") is a void method call, and thus it cannot be parameterized
   6 | Expression assertEquals(0,d1.getItemCount(0)) is a void method call, and thus it cannot be parameterized
   7 | Expression d.addValue(new Double(1.0),"R1","C1") cannot be parameterized, because it has dependencies to/from statements that will be extracted
   8 | Expression d.addValue(new Double(1.0),"R1","C1") is a void method call, and thus it cannot be parameterized
   9 | Expression assertEquals(0,d1.getItemCount(0)) is a void method call, and thus it cannot be parameterized
   10 | Expression assertEquals(1,d.getColumnCount()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   11 | Expression d1.addBin(new SimpleHistogramBin(0.0,1.0)) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   12 | Expression assertEquals(1,d.getColumnCount()) is a void method call, and thus it cannot be parameterized
   13 | Expression d1.addBin(new SimpleHistogramBin(0.0,1.0)) is a void method call, and thus it cannot be parameterized
   14 | Expression assertEquals(1,d.getColumnCount()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   15 | Expression d1.addBin(new SimpleHistogramBin(0.0,1.0)) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   16 | Expression assertEquals(1,d.getColumnCount()) is a void method call, and thus it cannot be parameterized
   17 | Expression d1.addBin(new SimpleHistogramBin(0.0,1.0)) is a void method call, and thus it cannot be parameterized
   18 | Unmatched statement d.addValue(new Double(2.0),"R1","C2"); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
   19 | Expression assertEquals(2,d.getColumnCount()) is a void method call, and thus it cannot be parameterized
   20 | Expression d1.addObservation(0.5) is a void method call, and thus it cannot be parameterized
   21 | Expression assertEquals(2,d.getColumnCount()) is a void method call, and thus it cannot be parameterized
   22 | Expression d1.addObservation(0.5) is a void method call, and thus it cannot be parameterized