ContextFactory factory = new ContextFactory(); // top-level structure IStructureType type = factory.createStructure("userlist", "ns"); type.setCardinality(MULTIPLICITY.ONE_TO_ONE); // mandatory String-based attribute IAttributeType attr = type.addAttribute("name", "ns"); // optional String-based attribute IAttributeType attr2 = type.addAttribute("description", "ns"); IAttributeType result1 = type.getAttribute("name", "ns"); assertEquals(attr, result1);
ContextFactory factory = new ContextFactory(); // top-level structure IStructureType type = factory.createStructure("userlist", "ns"); type.setCardinality(MULTIPLICITY.ONE_TO_ONE); // mandatory String-based attribute IAttributeType attr = type.addAttribute("name", "ns"); // optional String-based attribute IAttributeType attr2 = type.addAttribute("description", "ns"); IAttributeType result1 = type.getAttribute("name", "ns"); assertEquals(attr, result1);
Clone fragments detected by clone detection tool
File path: /columba-1.4-src/core/src/test/java/org/columba/core/context/ContextTest.java File path: /columba-1.4-src/core/src/test/java/org/columba/core/context/ContextTest.java
Method name: void test() Method name: void testWithValue()
Number of AST nodes: 7 Number of AST nodes: 7
1
ContextFactory factory = new ContextFactory();
1
ContextFactory factory = new ContextFactory();
2
		// top-level structure
2
		// top-level structure
3
		IStructureType type = factory.createStructure("userlist", "ns");
3
		IStructureType type = factory.createStructure("userlist", "ns");
4
		type.setCardinality(MULTIPLICITY.ONE_TO_ONE);
4
		type.setCardinality(MULTIPLICITY.ONE_TO_ONE);
5
		// mandatory String-based attribute
5
		// mandatory String-based attribute
6
		IAttributeType attr = type.addAttribute("name", "ns");
6
		IAttributeType attr = type.addAttribute("name", "ns");
7
		// optional String-based attribute
7
		// optional String-based attribute
8
		IAttributeType attr2 = type.addAttribute("description", "ns");
8
		IAttributeType attr2 = type.addAttribute("description", "ns");
9
		IAttributeType result1 = type.getAttribute("name", "ns");
9
		IAttributeType result1 = type.getAttribute("name", "ns");
10
		assertEquals(attr, result1);
10
		assertEquals(attr, result1);
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 comparisons22
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements7
    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 1
    Mapped Statements
    ID Statement ID Statement
    1
    ContextFactory factory = new ContextFactory();
    1
    ContextFactory factory = new ContextFactory();
    2
    IStructureType type = factory.createStructure("userlist", "ns");
    2
    IStructureType type = factory.createStructure("userlist", "ns");
    3
    type.setCardinality(MULTIPLICITY.ONE_TO_ONE);
    3
    type.setCardinality(MULTIPLICITY.ONE_TO_ONE);
    4
    IAttributeType attr = type.addAttribute("name", "ns");
    4
    IAttributeType attr = type.addAttribute("name", "ns");
    5
    IAttributeType attr2 = type.addAttribute("description", "ns");
    5
    IAttributeType attr2 = type.addAttribute("description", "ns");
    6
    IAttributeType result1 = type.getAttribute("name", "ns");
    6
    IAttributeType result1 = type.getAttribute("name", "ns");
    7
    assertEquals(attr, result1);
    7
    assertEquals(attr, result1);
    Precondition Violations (1)
    Row Violation
    1Clone fragment #1 returns variables , while Clone fragment #2 returns variables factory, type