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 cases0
Number of non-refactorable cases1
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. {Non-refactorable}
    Mapping Summary
    Number of mapped statements16
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    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.moveUp(filterThree);
    10
    filterList.moveUp(filterThree);
    10
    filterList.moveDown(filterOne);
    Differences
    Expression1Expression2Difference
    moveUpmoveDownMETHOD_INVOCATION_NAME_MISMATCH
    filterThreefilterOneVARIABLE_NAME_MISMATCH
    Preondition Violations
    Expression filterList.moveUp(filterThree) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression filterList.moveDown(filterOne) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression filterList.moveUp(filterThree) is a void method call, and thus it cannot be parameterized
    Expression filterList.moveDown(filterOne) is a void method call, and thus it cannot be parameterized
    Expression filterThree cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression filterOne cannot be parameterized, because it has dependencies to/from statements that will be extracted
    10
    filterList.moveDown(filterOne);
    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);
    12
    filterList.moveDown(filterOne);
    Differences
    Expression1Expression2Difference
    moveUpmoveDownMETHOD_INVOCATION_NAME_MISMATCH
    filterThreefilterOneVARIABLE_NAME_MISMATCH
    Preondition Violations
    Expression filterList.moveUp(filterThree) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression filterList.moveDown(filterOne) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression filterList.moveUp(filterThree) is a void method call, and thus it cannot be parameterized
    Expression filterList.moveDown(filterOne) is a void method call, and thus it cannot be parameterized
    Expression filterThree cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression filterOne cannot be parameterized, 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.", filterThree, filterList.get(0));
    13
    assertEquals("The get(int) method returned the wrong filter.", filterThree, filterList.get(0));
    13
    assertEquals("The get(int) method returned the wrong filter.", filterOne, filterList.get(2));
    Differences
    Expression1Expression2Difference
    filterThreefilterOneVARIABLE_NAME_MISMATCH
    02LITERAL_VALUE_MISMATCH
    Preondition Violations
    Expression filterThree cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression filterOne cannot be parameterized, 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));
    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.moveUp(filterThree);
    15
    filterList.moveUp(filterThree);
    15
    filterList.moveDown(filterOne);
    Differences
    Expression1Expression2Difference
    moveUpmoveDownMETHOD_INVOCATION_NAME_MISMATCH
    filterThreefilterOneVARIABLE_NAME_MISMATCH
    Preondition Violations
    Expression filterList.moveUp(filterThree) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression filterList.moveDown(filterOne) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression filterList.moveUp(filterThree) is a void method call, and thus it cannot be parameterized
    Expression filterList.moveDown(filterOne) is a void method call, and thus it cannot be parameterized
    Expression filterThree cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression filterOne cannot be parameterized, because it has dependencies to/from statements that will be extracted
    15
    filterList.moveDown(filterOne);
    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));
    16
    assertEquals("The get(int) method returned the wrong filter.", filterOne, filterList.get(2));
    Differences
    Expression1Expression2Difference
    filterThreefilterOneVARIABLE_NAME_MISMATCH
    02LITERAL_VALUE_MISMATCH
    Preondition Violations
    Expression filterThree cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression filterOne cannot be parameterized, 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));
    Precondition Violations (22)
    Row Violation
    1Expression filterList.moveUp(filterThree) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression filterList.moveDown(filterOne) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression filterList.moveUp(filterThree) is a void method call, and thus it cannot be parameterized
    4Expression filterList.moveDown(filterOne) is a void method call, and thus it cannot be parameterized
    5Expression filterThree cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6Expression filterOne cannot be parameterized, because it has dependencies to/from statements that will be extracted
    7Expression filterList.moveUp(filterThree) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    8Expression filterList.moveDown(filterOne) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    9Expression filterList.moveUp(filterThree) is a void method call, and thus it cannot be parameterized
    10Expression filterList.moveDown(filterOne) is a void method call, and thus it cannot be parameterized
    11Expression filterThree cannot be parameterized, because it has dependencies to/from statements that will be extracted
    12Expression filterOne cannot be parameterized, because it has dependencies to/from statements that will be extracted
    13Expression filterThree cannot be parameterized, because it has dependencies to/from statements that will be extracted
    14Expression filterOne cannot be parameterized, because it has dependencies to/from statements that will be extracted
    15Expression filterList.moveUp(filterThree) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    16Expression filterList.moveDown(filterOne) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    17Expression filterList.moveUp(filterThree) is a void method call, and thus it cannot be parameterized
    18Expression filterList.moveDown(filterOne) is a void method call, and thus it cannot be parameterized
    19Expression filterThree cannot be parameterized, because it has dependencies to/from statements that will be extracted
    20Expression filterOne cannot be parameterized, because it has dependencies to/from statements that will be extracted
    21Expression filterThree cannot be parameterized, because it has dependencies to/from statements that will be extracted
    22Expression filterOne cannot be parameterized, because it has dependencies to/from statements that will be extracted