1087-4-8

TimeZone zone = TimeZone.getTimeZone("Europe/Tallinn"); Millisecond m1 = new Millisecond(new Date(1016722559122L), zone); Millisecond m2 = new Millisecond(new Date(1016722559123L), zone); assertEquals(122, m1.getMillisecond()); assertEquals(1016722559122L, m1.getLastMillisecond(zone)); assertEquals(123, m2.getMillisecond()); assertEquals(1016722559123L, m2.getFirstMillisecond(zone));
TimeZone zone = TimeZone.getTimeZone("Europe/Istanbul"); Quarter q1 = new Quarter(new Date(1017608399999L), zone); Quarter q2 = new Quarter(new Date(1017608400000L), zone); assertEquals(1, q1.getQuarter()); assertEquals(1017608399999L, q1.getLastMillisecond(zone)); assertEquals(2, q2.getQuarter()); assertEquals(1017608400000L, q2.getFirstMillisecond(zone));

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

1

    TimeZone zone = TimeZone.getTimeZone("Europe/Tallinn");↵

1

    TimeZone zone = TimeZone.getTimeZone("Europe/Istanbul");↵

2

            Millisecond m1 = new Millisecond(new Date(1016722559122L), zone);↵

2

            Quarter q1 = new Quarter(new Date(1017608399999L), zone);↵

3

            Millisecond m2 = new Millisecond(new Date(1016722559123L), zone);↵

3

            Quarter q2 = new Quarter(new Date(1017608400000L), zone);↵

4

            assertEquals(122, m1.getMillisecond());↵

4

            assertEquals(1, q1.getQuarter());↵

5

            assertEquals(1016722559122L, m1.getLastMillisecond(zone));↵

5

            assertEquals(1017608399999L, q1.getLastMillisecond(zone));↵

6

            assertEquals(123, m2.getMillisecond());↵

6

            assertEquals(2, q2.getQuarter());↵

7

            assertEquals(1016722559123L, m2.getFirstMillisecond(zone));

7

            assertEquals(1017608400000L, q2.getFirstMillisecond(zone));

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

1. {Non-refactorable}

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

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

   1

       TimeZone zone = TimeZone.getTimeZone("Europe/Tallinn");

   1 | TimeZone zone = TimeZone.getTimeZone("Europe/Tallinn");
   1 | TimeZone zone = TimeZone.getTimeZone("Europe/Istanbul");

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   "Europe/Tallinn" | "Europe/Istanbul" | LITERAL_VALUE_MISMATCH

   1

       TimeZone zone = TimeZone.getTimeZone("Europe/Istanbul");

   2

       Millisecond m1 = new Millisecond(new Date(1016722559122L), zone);

   2 | Millisecond m1 = new Millisecond(new Date(1016722559122L), zone);
   2 | Quarter q1 = new Quarter(new Date(1017608399999L), zone);

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   org.jfree.data.time.Millisecond | org.jfree.data.time.Quarter | SUBCLASS_TYPE_MISMATCH
   m1 | q1 | VARIABLE_NAME_MISMATCH
   org.jfree.data.time.Millisecond | org.jfree.data.time.Quarter | SUBCLASS_TYPE_MISMATCH
   org.jfree.data.time.Millisecond | org.jfree.data.time.Quarter | SUBCLASS_TYPE_MISMATCH
   1016722559122L | 1017608399999L | LITERAL_VALUE_MISMATCH

   Preondition Violations
   Expression new Millisecond(new Date(1016722559122L),zone) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   Expression new Quarter(new Date(1017608399999L),zone) cannot be parameterized, because it has dependencies to/from statements that will be extracted

   2

       Quarter q1 = new Quarter(new Date(1017608399999L), zone);

   3

       Millisecond m2 = new Millisecond(new Date(1016722559123L), zone);

   3 | Millisecond m2 = new Millisecond(new Date(1016722559123L), zone);
   3 | Quarter q2 = new Quarter(new Date(1017608400000L), zone);

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   org.jfree.data.time.Millisecond | org.jfree.data.time.Quarter | SUBCLASS_TYPE_MISMATCH
   m2 | q2 | VARIABLE_NAME_MISMATCH
   org.jfree.data.time.Millisecond | org.jfree.data.time.Quarter | SUBCLASS_TYPE_MISMATCH
   org.jfree.data.time.Millisecond | org.jfree.data.time.Quarter | SUBCLASS_TYPE_MISMATCH
   1016722559123L | 1017608400000L | LITERAL_VALUE_MISMATCH

   Preondition Violations
   Expression new Millisecond(new Date(1016722559123L),zone) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   Expression new Quarter(new Date(1017608400000L),zone) cannot be parameterized, because it has dependencies to/from statements that will be extracted

   3

       Quarter q2 = new Quarter(new Date(1017608400000L), zone);

   4

       assertEquals(122, m1.getMillisecond());

   4 | assertEquals(122, m1.getMillisecond());
   5 | assertEquals(1017608399999L, q1.getLastMillisecond(zone));

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   122 | 1017608399999L | LITERAL_VALUE_MISMATCH

   5

       assertEquals(1017608399999L, q1.getLastMillisecond(zone));

   5

       assertEquals(1016722559122L, m1.getLastMillisecond(zone));

   5 | assertEquals(1016722559122L, m1.getLastMillisecond(zone));
   4 | assertEquals(1, q1.getQuarter());

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   1016722559122L | 1 | LITERAL_VALUE_MISMATCH

   4

       assertEquals(1, q1.getQuarter());

   6

       assertEquals(2, q2.getQuarter());

   6

       assertEquals(123, m2.getMillisecond());

   7

       assertEquals(1016722559123L, m2.getFirstMillisecond(zone));

   7 | assertEquals(1016722559123L, m2.getFirstMillisecond(zone));
   7 | assertEquals(1017608400000L, q2.getFirstMillisecond(zone));

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   1016722559123L | 1017608400000L | LITERAL_VALUE_MISMATCH
   m2 | q2 | VARIABLE_NAME_MISMATCH
   org.jfree.data.time.Millisecond | org.jfree.data.time.Quarter | SUBCLASS_TYPE_MISMATCH

   7

       assertEquals(1017608400000L, q2.getFirstMillisecond(zone));

   Precondition Violations (5)
   Row | Violation
   --- | ---
   1 | Expression new Millisecond(new Date(1016722559122L),zone) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   2 | Expression new Quarter(new Date(1017608399999L),zone) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   3 | Expression new Millisecond(new Date(1016722559123L),zone) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   4 | Expression new Quarter(new Date(1017608400000L),zone) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   5 | Clone fragment #1 returns variable m2 with type org.jfree.data.time.Millisecond , while Clone fragment #2 returns variable q2 with type org.jfree.data.time.Quarter