311-2-3

TimePeriodValues s = new TimePeriodValues("Test"); assertEquals(-1, s.getMaxStartIndex()); s.add(new SimpleTimePeriod(100L, 200L), 1.0); assertEquals(0, s.getMaxStartIndex()); s.add(new SimpleTimePeriod(300L, 400L), 2.0); assertEquals(1, s.getMaxStartIndex()); s.add(new SimpleTimePeriod(0L, 50L), 3.0); assertEquals(1, s.getMaxStartIndex());
TimePeriodValues s = new TimePeriodValues("Test"); assertEquals(-1, s.getMaxEndIndex()); s.add(new SimpleTimePeriod(100L, 200L), 1.0); assertEquals(0, s.getMaxEndIndex()); s.add(new SimpleTimePeriod(300L, 400L), 2.0); assertEquals(1, s.getMaxEndIndex()); s.add(new SimpleTimePeriod(0L, 50L), 3.0); assertEquals(1, s.getMaxEndIndex());

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

1

    TimePeriodValues s = new TimePeriodValues("Test");↵

1

    TimePeriodValues s = new TimePeriodValues("Test");↵

2

            assertEquals(-1, s.getMaxStartIndex());↵

2

            assertEquals(-1, s.getMaxEndIndex());↵

3

            s.add(new SimpleTimePeriod(100L, 200L), 1.0);↵

3

            s.add(new SimpleTimePeriod(100L, 200L), 1.0);↵

4

            assertEquals(0, s.getMaxStartIndex());↵

4

            assertEquals(0, s.getMaxEndIndex());↵

5

            s.add(new SimpleTimePeriod(300L, 400L), 2.0);↵

5

            s.add(new SimpleTimePeriod(300L, 400L), 2.0);↵

6

            assertEquals(1, s.getMaxStartIndex());↵

6

            assertEquals(1, s.getMaxEndIndex());↵

7

            s.add(new SimpleTimePeriod(0L, 50L), 3.0);↵

7

            s.add(new SimpleTimePeriod(0L, 50L), 3.0);↵

8

            assertEquals(1, s.getMaxStartIndex());

8

            assertEquals(1, s.getMaxEndIndex());

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 declared in the same class
Number of node comparisons | 32

1. {Non-refactorable}

   Mapping Summary
   Number of mapped statements | 8
   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

       TimePeriodValues s = new TimePeriodValues("Test");

   1

       TimePeriodValues s = new TimePeriodValues("Test");

   2

       assertEquals(-1, s.getMaxStartIndex());

   2 | assertEquals(-1, s.getMaxStartIndex());
   2 | assertEquals(-1, s.getMaxEndIndex());

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   getMaxStartIndex | getMaxEndIndex | METHOD_INVOCATION_NAME_MISMATCH

   Preondition Violations
   Expression s.getMaxStartIndex() cannot be parameterized, because it has dependencies to/from statements that will be extracted
   Expression s.getMaxEndIndex() cannot be parameterized, because it has dependencies to/from statements that will be extracted

   2

       assertEquals(-1, s.getMaxEndIndex());

   3

       s.add(new SimpleTimePeriod(100L, 200L), 1.0);

   3

       s.add(new SimpleTimePeriod(100L, 200L), 1.0);

   4

       assertEquals(0, s.getMaxStartIndex());

   4 | assertEquals(0, s.getMaxStartIndex());
   4 | assertEquals(0, s.getMaxEndIndex());

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   getMaxStartIndex | getMaxEndIndex | METHOD_INVOCATION_NAME_MISMATCH

   Preondition Violations
   Expression s.getMaxStartIndex() cannot be parameterized, because it has dependencies to/from statements that will be extracted
   Expression s.getMaxEndIndex() cannot be parameterized, because it has dependencies to/from statements that will be extracted

   4

       assertEquals(0, s.getMaxEndIndex());

   5

       s.add(new SimpleTimePeriod(300L, 400L), 2.0);

   5

       s.add(new SimpleTimePeriod(300L, 400L), 2.0);

   6

       assertEquals(1, s.getMaxStartIndex());

   6 | assertEquals(1, s.getMaxStartIndex());
   6 | assertEquals(1, s.getMaxEndIndex());

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   getMaxStartIndex | getMaxEndIndex | METHOD_INVOCATION_NAME_MISMATCH

   Preondition Violations
   Expression s.getMaxStartIndex() cannot be parameterized, because it has dependencies to/from statements that will be extracted
   Expression s.getMaxEndIndex() cannot be parameterized, because it has dependencies to/from statements that will be extracted

   6

       assertEquals(1, s.getMaxEndIndex());

   7

       s.add(new SimpleTimePeriod(0L, 50L), 3.0);

   7

       s.add(new SimpleTimePeriod(0L, 50L), 3.0);

   8

       assertEquals(1, s.getMaxStartIndex());

   8 | assertEquals(1, s.getMaxStartIndex());
   8 | assertEquals(1, s.getMaxEndIndex());

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   getMaxStartIndex | getMaxEndIndex | METHOD_INVOCATION_NAME_MISMATCH

   Preondition Violations
   Expression s.getMaxStartIndex() cannot be parameterized, because it has dependencies to/from statements that will be extracted
   Expression s.getMaxEndIndex() cannot be parameterized, because it has dependencies to/from statements that will be extracted

   8

       assertEquals(1, s.getMaxEndIndex());

   Precondition Violations (8)
   Row | Violation
   --- | ---
   1 | Expression s.getMaxStartIndex() cannot be parameterized, because it has dependencies to/from statements that will be extracted
   2 | Expression s.getMaxEndIndex() cannot be parameterized, because it has dependencies to/from statements that will be extracted
   3 | Expression s.getMaxStartIndex() cannot be parameterized, because it has dependencies to/from statements that will be extracted
   4 | Expression s.getMaxEndIndex() cannot be parameterized, because it has dependencies to/from statements that will be extracted
   5 | Expression s.getMaxStartIndex() cannot be parameterized, because it has dependencies to/from statements that will be extracted
   6 | Expression s.getMaxEndIndex() cannot be parameterized, because it has dependencies to/from statements that will be extracted
   7 | Expression s.getMaxStartIndex() cannot be parameterized, because it has dependencies to/from statements that will be extracted
   8 | Expression s.getMaxEndIndex() cannot be parameterized, because it has dependencies to/from statements that will be extracted