OHLCSeries s1 = new OHLCSeries("s1"); s1.add(new Year(2006), 2.0, 4.0, 1.0, 3.0); s1.add(new Year(2011), 2.1, 4.1, 1.1, 3.1); s1.add(new Year(2010), 2.2, 4.2, 1.2, 3.2); assertEquals(3, s1.getItemCount()); s1.remove(new Year(2010)); assertEquals(new Year(2011), s1.getPeriod(1)); s1.remove(new Year(2006)); assertEquals(new Year(2011), s1.getPeriod(0));
OHLCSeries s1 = new OHLCSeries("s1"); assertEquals(Integer.MAX_VALUE, s1.getMaximumItemCount()); s1.setMaximumItemCount(2); assertEquals(2, s1.getMaximumItemCount()); s1.add(new Year(2006), 1.0, 1.1, 1.1, 1.1); s1.add(new Year(2007), 2.0, 2.2, 2.2, 2.2); s1.add(new Year(2008), 3.0, 3.3, 3.3, 3.3); assertEquals(new Year(2007), s1.getPeriod(0)); assertEquals(new Year(2008), s1.getPeriod(1));
Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/tests/org/jfree/data/time/ohlc/junit/OHLCSeriesTests.java File path: /jfreechart-1.0.10/tests/org/jfree/data/time/ohlc/junit/OHLCSeriesTests.java
Method name: void testRemove() Method name: void testSetMaximumItemCount()
Number of AST nodes: 9 Number of AST nodes: 9
1
OHLCSeries s1 = new OHLCSeries("s1");
1
OHLCSeries s1 = new OHLCSeries("s1");
2
        s1.add(new Year(2006), 2.0, 4.0, 1.0, 3.0
2
        assertEquals(Integer.MAX_VALUE, s1.getMaximumItemCount());
3
        s1.setMaximumItemCount(2);
3
);
4
        assertEquals(2, s1.getMaximumItemCount());
4
        s1.add(new Year(2011), 2.1, 4.1, 1.1, 3.1);
5
        s1.add(new Year(2006), 1.0, 1.1, 1.1, 1.1);
5
        s1.add(new Year(2010), 2.2, 4.2, 1.2, 3.2);
6
        s1.add(new Year(2007), 2.0, 2.2, 2.2, 2.2);
6
        assertEquals(3, s1.getItemCount());
7
        
7
        
8
        s1.remove(new Year(2010));
8
s1.add(new Year(2008), 3.0, 3.3, 3.3, 3.3);
9
        assertEquals(new Year(2011), s1.getPeriod(1));
9
        assertEquals(new Year(2007), s1.getPeriod(
10
        
11
        s1.remove(new Year(2006));
10
0));
12
        assertEquals(new Year(2011), s1.getPeriod(0));
11
        assertEquals(new Year(2008), s1.getPeriod(1));
Summary
Number of common nesting structure subtrees1
Number of refactorable cases1
Number of non-refactorable cases0
Time elapsed for finding largest common nesting structure subtrees (ms)0.0
Clones locationClones are declared in the same class
Number of node comparisons53
  1. {Refactorable}
    Mapping Summary
    Number of mapped statements7
    Number of unmapped statements in the first code fragment2
    Number of unmapped statements in the second code fragment2
    Time elapsed for statement mapping (ms)0.0
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    OHLCSeries s1 = new OHLCSeries("s1");
    1
    OHLCSeries s1 = new OHLCSeries("s1");
                                                                                                                            
    2
    assertEquals(Integer.MAX_VALUE, s1.getMaximumItemCount());
    Preondition Violations
    Unmatched statement assertEquals(Integer.MAX_VALUE,s1.getMaximumItemCount()); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    2
    assertEquals(Integer.MAX_VALUE, s1.getMaximumItemCount());
                                                              
    3
    s1.setMaximumItemCount(2);
    Preondition Violations
    Unmatched statement s1.setMaximumItemCount(2); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3
    s1.setMaximumItemCount(2);
    2
    s1.add(new Year(2006), 2.0, 4.0, 1.0, 3.0);
    2
    s1.add(new Year(2006), 2.0, 4.0, 1.0, 3.0);
    5
    s1.add(new Year(2006), 1.0, 1.1, 1.1, 1.1);
    Differences
    Expression1Expression2Difference
    2.01.0LITERAL_VALUE_MISMATCH
    4.01.1LITERAL_VALUE_MISMATCH
    1.01.1LITERAL_VALUE_MISMATCH
    3.01.1LITERAL_VALUE_MISMATCH
    5
    s1.add(new Year(2006), 1.0, 1.1, 1.1, 1.1);
    3
    s1.add(new Year(2011), 2.1, 4.1, 1.1, 3.1);
    3
    s1.add(new Year(2011), 2.1, 4.1, 1.1, 3.1);
    6
    s1.add(new Year(2007), 2.0, 2.2, 2.2, 2.2);
    Differences
    Expression1Expression2Difference
    20112007LITERAL_VALUE_MISMATCH
    2.12.0LITERAL_VALUE_MISMATCH
    4.12.2LITERAL_VALUE_MISMATCH
    1.12.2LITERAL_VALUE_MISMATCH
    3.12.2LITERAL_VALUE_MISMATCH
    6
    s1.add(new Year(2007), 2.0, 2.2, 2.2, 2.2);
    4
    s1.add(new Year(2010), 2.2, 4.2, 1.2, 3.2);
    4
    s1.add(new Year(2010), 2.2, 4.2, 1.2, 3.2);
    7
    s1.add(new Year(2008), 3.0, 3.3, 3.3, 3.3);
    Differences
    Expression1Expression2Difference
    20102008LITERAL_VALUE_MISMATCH
    2.23.0LITERAL_VALUE_MISMATCH
    4.23.3LITERAL_VALUE_MISMATCH
    1.23.3LITERAL_VALUE_MISMATCH
    3.23.3LITERAL_VALUE_MISMATCH
    7
    s1.add(new Year(2008), 3.0, 3.3, 3.3, 3.3);
    5
    assertEquals(3, s1.getItemCount());
    5
    assertEquals(3, s1.getItemCount());
    4
    assertEquals(2, s1.getMaximumItemCount());
    Differences
    Expression1Expression2Difference
    32LITERAL_VALUE_MISMATCH
    getItemCountgetMaximumItemCountMETHOD_INVOCATION_NAME_MISMATCH
    Preondition Violations
    Expression s1.getItemCount() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression s1.getMaximumItemCount() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4
    assertEquals(2, s1.getMaximumItemCount());
    6
    s1.remove(new Year(2010));
    6
    s1.remove(new Year(2010));
    Preondition Violations
    Unmatched statement s1.remove(new Year(2010)); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                              
    7
    assertEquals(new Year(2011), s1.getPeriod(1));
    7
    assertEquals(new Year(2011), s1.getPeriod(1));
    9
    assertEquals(new Year(2008), s1.getPeriod(1));
    Differences
    Expression1Expression2Difference
    20112008LITERAL_VALUE_MISMATCH
    9
    assertEquals(new Year(2008), s1.getPeriod(1));
    8
    s1.remove(new Year(2006));
    8
    s1.remove(new Year(2006));
    Preondition Violations
    Unmatched statement s1.remove(new Year(2006)); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                              
    9
    assertEquals(new Year(2011), s1.getPeriod(0));
    9
    assertEquals(new Year(2011), s1.getPeriod(0));
    8
    assertEquals(new Year(2007), s1.getPeriod(0));
    Differences
    Expression1Expression2Difference
    20112007LITERAL_VALUE_MISMATCH
    8
    assertEquals(new Year(2007), s1.getPeriod(0));
    Precondition Violations (6)
    Row Violation
    1Unmatched statement assertEquals(Integer.MAX_VALUE,s1.getMaximumItemCount()); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    2Unmatched statement s1.setMaximumItemCount(2); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3Expression s1.getItemCount() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Expression s1.getMaximumItemCount() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5Unmatched statement s1.remove(new Year(2010)); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    6Unmatched statement s1.remove(new Year(2006)); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted