FilterList filterList = new FilterList(new XmlElement()); IFilter filterOne = createNamedFilter("ONE"); IFilter filterTwo = createNamedFilter("TWO"); IFilter filterThree = createNamedFilter("THREE"); filterList.add(filterOne); filterList.add(filterTwo); filterList.add(filterThree); assertEquals("The get(int) method returned the wrong filter.", filterOne, filterList.get(0)); assertEquals("The get(int) method returned the wrong filter.", filterThree, filterList.get(2)); filterList.moveUp(filterThree); assertEquals("The get(int) method returned the wrong filter.", filterThree, filterList.get(1)); filterList.moveUp(filterThree); assertEquals("The get(int) method returned the wrong filter.", filterThree, filterList.get(0)); assertEquals("The get(int) method returned the wrong filter.", filterOne, filterList.get(1)); filterList.moveUp(filterThree); assertEquals("The get(int) method returned the wrong filter.", filterThree, filterList.get(0));
FilterList filterList = new FilterList(new XmlElement()); IFilter filterOne = createNamedFilter("ONE"); IFilter filterTwo = createNamedFilter("TWO"); IFilter filterThree = createNamedFilter("THREE"); filterList.add(filterOne); filterList.add(filterTwo); filterList.add(filterThree); assertEquals("The get(int) method returned the wrong filter.", filterOne, filterList.get(0)); assertEquals("The get(int) method returned the wrong filter.", filterThree, filterList.get(2)); filterList.moveDown(filterOne); assertEquals("The get(int) method returned the wrong filter.", filterOne, filterList.get(1)); filterList.moveDown(filterOne); assertEquals("The get(int) method returned the wrong filter.", filterOne, filterList.get(2)); assertEquals("The get(int) method returned the wrong filter.", filterThree, filterList.get(1)); filterList.moveDown(filterOne); assertEquals("The get(int) method returned the wrong filter.", filterOne, filterList.get(2));
Clone fragments detected by clone detection tool
File path: /columba-1.4-src/mail/src/test/java/org/columba/mail/filter/FilterListTest.java File path: /columba-1.4-src/mail/src/test/java/org/columba/mail/filter/FilterListTest.java
Method name: void testMoveUp() Method name: void testMoveDown()
Number of AST nodes: 16 Number of AST nodes: 16
1
FilterList filterList = new FilterList(new XmlElement());
1
FilterList filterList = new FilterList(new XmlElement());
2
		IFilter filterOne = createNamedFilter("ONE");
2
		IFilter filterOne = createNamedFilter("ONE");
3
		IFilter filterTwo = createNamedFilter("TWO");
3
		IFilter filterTwo = createNamedFilter("TWO");
4
		IFilter filterThree = createNamedFilter("THREE");
4
		IFilter filterThree = createNamedFilter("THREE");
5
		filterList.add(filterOne);
5
		filterList.add(filterOne);
6
		filterList.add(filterTwo);
6
		filterList.add(filterTwo);
7
		filterList.add(filterThree);
7
		filterList.add(filterThree);
8
		assertEquals("The get(int) method returned the wrong filter.",
8
		assertEquals("The get(int) method returned the wrong filter.",
9
				filterOne, filterList.get(0));
9
				filterOne, filterList.get(0));
10
		assertEquals("The get(int) method returned the wrong filter.",
10
		assertEquals("The get(int) method returned the wrong filter.",
11
				filterThree, filterList.get(2));
11
				filterThree, filterList.get(2));
12
		filterList.moveUp(filterThree);
12
		filterList.moveDown(filterOne);
13
		assertEquals("The get(int) method returned the wrong filter.",
13
		assertEquals("The get(int) method returned the wrong filter.",
14
				filterThree, filterList.get(1));
14
				filterOne, filterList.get(1));
15
		filterList.moveUp(filterThree);
15
		filterList.moveDown(filterOne);
16
		assertEquals("The get(int) method returned the wrong filter.",
16
		assertEquals("The get(int) method returned the wrong filter.",
17
				filterThree, filterList.get(0));
17
				filterOne, filterList.get(2));
18
		assertEquals("The get(int) method returned the wrong filter.",
18
		assertEquals("The get(int) method returned the wrong filter.",
19
				filterOne, filterList.get(1));
19
				filterThree, filterList.get(1));
20
		filterList.moveUp(filterThree);
20
		filterList.moveDown(filterOne);
21
		assertEquals("The get(int) method returned the wrong filter.",
21
		assertEquals("The get(int) method returned the wrong filter.",
22
				filterThree, filterList.get(0));
22
				filterOne, filterList.get(2));
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 comparisons226
  1. {Refactorable}
    Mapping Summary
    Number of mapped statements11
    Number of unmapped statements in the first code fragment5
    Number of unmapped statements in the second code fragment5
    Time elapsed for statement mapping (ms)0.0
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    FilterList filterList = new FilterList(new XmlElement());
    1
    FilterList filterList = new FilterList(new XmlElement());
    2
    IFilter filterOne = createNamedFilter("ONE");
    2
    IFilter filterOne = createNamedFilter("ONE");
    3
    IFilter filterTwo = createNamedFilter("TWO");
    3
    IFilter filterTwo = createNamedFilter("TWO");
    4
    IFilter filterThree = createNamedFilter("THREE");
    4
    IFilter filterThree = createNamedFilter("THREE");
    5
    filterList.add(filterOne);
    5
    filterList.add(filterOne);
    6
    filterList.add(filterTwo);
    6
    filterList.add(filterTwo);
    7
    filterList.add(filterThree);
    7
    filterList.add(filterThree);
    8
    assertEquals("The get(int) method returned the wrong filter.", filterOne, filterList.get(0));
    8
    assertEquals("The get(int) method returned the wrong filter.", filterOne, filterList.get(0));
    9
    assertEquals("The get(int) method returned the wrong filter.", filterThree, filterList.get(2));
    9
    assertEquals("The get(int) method returned the wrong filter.", filterThree, filterList.get(2));
                                                                          
    10
    filterList.moveDown(filterOne);
    Preondition Violations
    Unmatched statement filterList.moveDown(filterOne); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    10
    filterList.moveDown(filterOne);
    10
    filterList.moveUp(filterThree);
    10
    filterList.moveUp(filterThree);
    Preondition Violations
    Unmatched statement filterList.moveUp(filterThree); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                          
                                                                          
    12
    filterList.moveDown(filterOne);
    Preondition Violations
    Unmatched statement filterList.moveDown(filterOne); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    12
    filterList.moveDown(filterOne);
                                                                                                                                                                                                  
    13
    assertEquals("The get(int) method returned the wrong filter.", filterOne, filterList.get(2));
    Preondition Violations
    Unmatched statement assertEquals("The get(int) method returned the wrong filter.",filterOne,filterList.get(2)); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    13
    assertEquals("The get(int) method returned the wrong filter.", filterOne, filterList.get(2));
    11
    assertEquals("The get(int) method returned the wrong filter.", filterThree, filterList.get(1));
    14
    assertEquals("The get(int) method returned the wrong filter.", filterThree, filterList.get(1));
    12
    filterList.moveUp(filterThree);
    12
    filterList.moveUp(filterThree);
    Preondition Violations
    Unmatched statement filterList.moveUp(filterThree); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                          
    13
    assertEquals("The get(int) method returned the wrong filter.", filterThree, filterList.get(0));
    13
    assertEquals("The get(int) method returned the wrong filter.", filterThree, filterList.get(0));
    Preondition Violations
    Unmatched statement assertEquals("The get(int) method returned the wrong filter.",filterThree,filterList.get(0)); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                                                                                                                                      
    14
    assertEquals("The get(int) method returned the wrong filter.", filterOne, filterList.get(1));
    11
    assertEquals("The get(int) method returned the wrong filter.", filterOne, filterList.get(1));
                                                                          
    15
    filterList.moveDown(filterOne);
    Preondition Violations
    Unmatched statement filterList.moveDown(filterOne); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    15
    filterList.moveDown(filterOne);
    15
    filterList.moveUp(filterThree);
    15
    filterList.moveUp(filterThree);
    Preondition Violations
    Unmatched statement filterList.moveUp(filterThree); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                          
                                                                                                                                                                                                  
    16
    assertEquals("The get(int) method returned the wrong filter.", filterOne, filterList.get(2));
    Preondition Violations
    Unmatched statement assertEquals("The get(int) method returned the wrong filter.",filterOne,filterList.get(2)); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    16
    assertEquals("The get(int) method returned the wrong filter.", filterOne, filterList.get(2));
    16
    assertEquals("The get(int) method returned the wrong filter.", filterThree, filterList.get(0));
    16
    assertEquals("The get(int) method returned the wrong filter.", filterThree, filterList.get(0));
    Preondition Violations
    Unmatched statement assertEquals("The get(int) method returned the wrong filter.",filterThree,filterList.get(0)); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                                                                                                                                      
    Precondition Violations (10)
    Row Violation
    1Unmatched statement filterList.moveDown(filterOne); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    2Unmatched statement filterList.moveUp(filterThree); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3Unmatched statement filterList.moveDown(filterOne); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4Unmatched statement assertEquals("The get(int) method returned the wrong filter.",filterOne,filterList.get(2)); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    5Unmatched statement filterList.moveUp(filterThree); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    6Unmatched statement assertEquals("The get(int) method returned the wrong filter.",filterThree,filterList.get(0)); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    7Unmatched statement filterList.moveDown(filterOne); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    8Unmatched statement filterList.moveUp(filterThree); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    9Unmatched statement assertEquals("The get(int) method returned the wrong filter.",filterOne,filterList.get(2)); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    10Unmatched statement assertEquals("The get(int) method returned the wrong filter.",filterThree,filterList.get(0)); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted