1616-1-3

Month m = new Month(12, 2000); m = (Month) m.next(); assertEquals(new Year(2001), m.getYear()); assertEquals(1, m.getMonth()); m = new Month(12, 9999); assertNull(m.next());
Week w = new Week(12, 2000); w = (Week) w.next(); assertEquals(new Year(2000), w.getYear()); assertEquals(13, w.getWeek()); w = new Week(53, 9999); assertNull(w.next());

Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/tests/org/jfree/data/time/junit/MonthTests.java |  | File path: /jfreechart-1.0.10/tests/org/jfree/data/time/junit/WeekTests.java
Method name: `void testNext()` |  | Method name: `void testNext()`
Number of AST nodes: 6 |  | Number of AST nodes: 6

1

    Month m = new Month(12, 2000);↵

1

    Week w = new Week(12, 2000);↵

2

            m = (Month) m.next();↵

2

            w = (Week) w.next();↵

3

            assertEquals(new Year(2001), m.getYear());↵

3

            assertEquals(new Year(2000), w.getYear());↵

4

            assertEquals(1, m.getMonth());↵

4

            assertEquals(13, w.getWeek());↵

5

            m = new Month(12, 9999);↵

5

            w = new Week(53, 9999);↵

6

            assertNull(m.next());

6

            assertNull(w.next());

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 | 20

1. {Non-refactorable}

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

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

   1

       Month m = new Month(12, 2000);

   1 | Month m = new Month(12, 2000);
   1 | Week w = new Week(12, 2000);

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   org.jfree.data.time.Month | org.jfree.data.time.Week | SUBCLASS_TYPE_MISMATCH
   m | w | VARIABLE_NAME_MISMATCH
   org.jfree.data.time.Month | org.jfree.data.time.Week | SUBCLASS_TYPE_MISMATCH
   org.jfree.data.time.Month | org.jfree.data.time.Week | SUBCLASS_TYPE_MISMATCH

   1

       Week w = new Week(12, 2000);

   2

       m = (Month)m.next();

   2 | m = (Month)m.next();
   2 | w = (Week)w.next();

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   m | w | VARIABLE_NAME_MISMATCH
   org.jfree.data.time.Month | org.jfree.data.time.Week | SUBCLASS_TYPE_MISMATCH
   org.jfree.data.time.Month | org.jfree.data.time.Week | SUBCLASS_TYPE_MISMATCH
   m | w | VARIABLE_NAME_MISMATCH
   org.jfree.data.time.Month | org.jfree.data.time.Week | SUBCLASS_TYPE_MISMATCH

   Preondition Violations
   Expression (Month)m.next() cannot be parameterized, because it has dependencies to/from statements that will be extracted
   Expression (Week)w.next() cannot be parameterized, because it has dependencies to/from statements that will be extracted

   2

       w = (Week)w.next();

   3

       assertEquals(new Year(2001), m.getYear());

   3 | assertEquals(new Year(2001), m.getYear());
   3 | assertEquals(new Year(2000), w.getYear());

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   2001 | 2000 | LITERAL_VALUE_MISMATCH
   m | w | VARIABLE_NAME_MISMATCH
   org.jfree.data.time.Month | org.jfree.data.time.Week | SUBCLASS_TYPE_MISMATCH

   Preondition Violations
   Expression m cannot be unified with expression w , because common superclass org.jfree.data.time.RegularTimePeriod does not declare member(s) public org.jfree.data.time.Year getYear()

   3

       assertEquals(new Year(2000), w.getYear());

   4

       assertEquals(1, m.getMonth());

   4 | assertEquals(1, m.getMonth());
   4 | assertEquals(13, w.getWeek());

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   1 | 13 | LITERAL_VALUE_MISMATCH
   getMonth | getWeek | METHOD_INVOCATION_NAME_MISMATCH
   m | w | VARIABLE_NAME_MISMATCH
   org.jfree.data.time.Month | org.jfree.data.time.Week | SUBCLASS_TYPE_MISMATCH

   Preondition Violations
   Expression m.getMonth() cannot be parameterized, because it has dependencies to/from statements that will be extracted
   Expression w.getWeek() cannot be parameterized, because it has dependencies to/from statements that will be extracted

   4

       assertEquals(13, w.getWeek());

   5

       m = new Month(12, 9999);

   5 | m = new Month(12, 9999);
   5 | w = new Week(53, 9999);

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   m | w | VARIABLE_NAME_MISMATCH
   org.jfree.data.time.Month | org.jfree.data.time.Week | SUBCLASS_TYPE_MISMATCH
   org.jfree.data.time.Month | org.jfree.data.time.Week | SUBCLASS_TYPE_MISMATCH
   12 | 53 | LITERAL_VALUE_MISMATCH

   5

       w = new Week(53, 9999);

   6

       assertNull(m.next());

   6 | assertNull(m.next());
   6 | assertNull(w.next());

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   m | w | VARIABLE_NAME_MISMATCH
   org.jfree.data.time.Month | org.jfree.data.time.Week | SUBCLASS_TYPE_MISMATCH

   6

       assertNull(w.next());

   Precondition Violations (5)
   Row | Violation
   --- | ---
   1 | Expression (Month)m.next() cannot be parameterized, because it has dependencies to/from statements that will be extracted
   2 | Expression (Week)w.next() cannot be parameterized, because it has dependencies to/from statements that will be extracted
   3 | Expression m cannot be unified with expression w , because common superclass org.jfree.data.time.RegularTimePeriod does not declare member(s) public org.jfree.data.time.Year getYear()
   4 | Expression m.getMonth() cannot be parameterized, because it has dependencies to/from statements that will be extracted
   5 | Expression w.getWeek() cannot be parameterized, because it has dependencies to/from statements that will be extracted