1087-1-10

TimeZone zone = TimeZone.getTimeZone("GMT"); Hour h1 = new Hour(new Date(1014307199999L), zone); Hour h2 = new Hour(new Date(1014307200000L), zone); assertEquals(15, h1.getHour()); assertEquals(1014307199999L, h1.getLastMillisecond(zone)); assertEquals(16, h2.getHour()); assertEquals(1014307200000L, h2.getFirstMillisecond(zone));
TimeZone zone = TimeZone.getTimeZone("America/Chicago"); Second s1 = new Second(new Date(1016751358999L), zone); Second s2 = new Second(new Date(1016751359000L), zone); assertEquals(58, s1.getSecond()); assertEquals(1016751358999L, s1.getLastMillisecond(zone)); assertEquals(59, s2.getSecond()); assertEquals(1016751359000L, s2.getFirstMillisecond(zone));

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

1

    TimeZone zone = TimeZone.getTimeZone("GMT");↵

1

    TimeZone zone = TimeZone.getTimeZone("America/Chicago");↵

2

            Hour h1 = new Hour(new Date(1014307199999L), zone);↵

2

            Second s1 = new Second(new Date(1016751358999L), zone);↵

3

            Hour h2 = new Hour(new Date(1014307200000L), zone);↵

3

            Second s2 = new Second(new Date(1016751359000L), zone);↵

4

            assertEquals(15, h1.getHour());↵

4

            assertEquals(58, s1.getSecond());↵

5

            assertEquals(1014307199999L, h1.getLastMillisecond(zone));↵

5

            assertEquals(1016751358999L, s1.getLastMillisecond(zone));↵

6

            assertEquals(16, h2.getHour());↵

6

            assertEquals(59, s2.getSecond());↵

7

            assertEquals(1014307200000L, h2.getFirstMillisecond(zone));

7

            assertEquals(1016751359000L, s2.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 | 7
   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

       TimeZone zone = TimeZone.getTimeZone("GMT");

   1 | TimeZone zone = TimeZone.getTimeZone("GMT");
   1 | TimeZone zone = TimeZone.getTimeZone("America/Chicago");

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   "GMT" | "America/Chicago" | LITERAL_VALUE_MISMATCH

   1

       TimeZone zone = TimeZone.getTimeZone("America/Chicago");

   2

       Hour h1 = new Hour(new Date(1014307199999L), zone);

   2 | Hour h1 = new Hour(new Date(1014307199999L), zone);
   2 | Second s1 = new Second(new Date(1016751358999L), zone);

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   org.jfree.data.time.Hour | org.jfree.data.time.Second | SUBCLASS_TYPE_MISMATCH
   h1 | s1 | VARIABLE_NAME_MISMATCH
   org.jfree.data.time.Hour | org.jfree.data.time.Second | SUBCLASS_TYPE_MISMATCH
   org.jfree.data.time.Hour | org.jfree.data.time.Second | SUBCLASS_TYPE_MISMATCH
   1014307199999L | 1016751358999L | LITERAL_VALUE_MISMATCH

   Preondition Violations
   Expression new Hour(new Date(1014307199999L),zone) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   Expression new Second(new Date(1016751358999L),zone) cannot be parameterized, because it has dependencies to/from statements that will be extracted

   2

       Second s1 = new Second(new Date(1016751358999L), zone);

   3

       Hour h2 = new Hour(new Date(1014307200000L), zone);

   3 | Hour h2 = new Hour(new Date(1014307200000L), zone);
   3 | Second s2 = new Second(new Date(1016751359000L), zone);

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   org.jfree.data.time.Hour | org.jfree.data.time.Second | SUBCLASS_TYPE_MISMATCH
   h2 | s2 | VARIABLE_NAME_MISMATCH
   org.jfree.data.time.Hour | org.jfree.data.time.Second | SUBCLASS_TYPE_MISMATCH
   org.jfree.data.time.Hour | org.jfree.data.time.Second | SUBCLASS_TYPE_MISMATCH
   1014307200000L | 1016751359000L | LITERAL_VALUE_MISMATCH

   Preondition Violations
   Expression new Hour(new Date(1014307200000L),zone) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   Expression new Second(new Date(1016751359000L),zone) cannot be parameterized, because it has dependencies to/from statements that will be extracted

   3

       Second s2 = new Second(new Date(1016751359000L), zone);

   4

       assertEquals(15, h1.getHour());

   4 | assertEquals(15, h1.getHour());
   5 | assertEquals(1016751358999L, s1.getLastMillisecond(zone));

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   15 | 1016751358999L | LITERAL_VALUE_MISMATCH

   5

       assertEquals(1016751358999L, s1.getLastMillisecond(zone));

   5

       assertEquals(1014307199999L, h1.getLastMillisecond(zone));

   5 | assertEquals(1014307199999L, h1.getLastMillisecond(zone));
   4 | assertEquals(58, s1.getSecond());

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   1014307199999L | 58 | LITERAL_VALUE_MISMATCH

   4

       assertEquals(58, s1.getSecond());

   6

       assertEquals(16, h2.getHour());

   6 | assertEquals(16, h2.getHour());
   6 | assertEquals(59, s2.getSecond());

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   16 | 59 | LITERAL_VALUE_MISMATCH
   getHour | getSecond | METHOD_INVOCATION_NAME_MISMATCH
   h2 | s2 | VARIABLE_NAME_MISMATCH
   org.jfree.data.time.Hour | org.jfree.data.time.Second | SUBCLASS_TYPE_MISMATCH

   Preondition Violations
   Expression h2.getHour() cannot be parameterized, because it has dependencies to/from statements that will be extracted
   Expression s2.getSecond() cannot be parameterized, because it has dependencies to/from statements that will be extracted

   6

       assertEquals(59, s2.getSecond());

   7

       assertEquals(1014307200000L, h2.getFirstMillisecond(zone));

   7 | assertEquals(1014307200000L, h2.getFirstMillisecond(zone));
   7 | assertEquals(1016751359000L, s2.getFirstMillisecond(zone));

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   1014307200000L | 1016751359000L | LITERAL_VALUE_MISMATCH
   h2 | s2 | VARIABLE_NAME_MISMATCH
   org.jfree.data.time.Hour | org.jfree.data.time.Second | SUBCLASS_TYPE_MISMATCH

   7

       assertEquals(1016751359000L, s2.getFirstMillisecond(zone));

   Precondition Violations (6)
   Row | Violation
   --- | ---
   1 | Expression new Hour(new Date(1014307199999L),zone) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   2 | Expression new Second(new Date(1016751358999L),zone) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   3 | Expression new Hour(new Date(1014307200000L),zone) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   4 | Expression new Second(new Date(1016751359000L),zone) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   5 | Expression h2.getHour() cannot be parameterized, because it has dependencies to/from statements that will be extracted
   6 | Expression s2.getSecond() cannot be parameterized, because it has dependencies to/from statements that will be extracted