File path: /emf-2.4.1/src/org/eclipse/emf/mapping/action/TypeMatchMappingAction.java | File path: /emf-2.4.1/src/org/eclipse/emf/mapping/action/NameMatchMappingAction.java | |||
Method name: boolean prepare()
|
Method name: boolean prepare()
|
|||
Number of AST nodes: 25 | Number of AST nodes: 25 | |||
1 | boolean result = false;↵ | 1 | boolean result = false;↵ | |
2 | if (collection != null)↵ | 2 | if (collection != null)↵ | |
3 | {↵ | 3 | {↵ | |
4 | Collection<Object> mappedObjects = new HashSet<Object>();↵ | 4 | Collection<Object> mappedObjects = new HashSet<Object>();↵ | |
5 | Collection<Object> mappingObjects = new HashSet<Object>();↵ | 5 | Collection<Object> mappingObjects = new HashSet<Object>();↵ | |
6 | MappingRoot mappingRoot = mappingDomain.getMappingRoot();↵ | 6 | MappingRoot mappingRoot = mappingDomain.getMappingRoot();↵ | |
7 | ↵ | 7 | ↵ | |
8 | for (Object object : collection)↵ | 8 | for (Object object : collection)↵ | |
9 | {↵ | 9 | {↵ | |
10 | if (object instanceof Mapping)↵ | 10 | if (object instanceof Mapping)↵ | |
11 | {↵ | 11 | {↵ | |
12 | appendIfCanExecute(TypeMatchMappingCommand.create(mappingDomain, (Mapping)object));↵ | 12 | appendIfCanExecute(NameMatchMappingCommand.create(mappingDomain, (Mapping)object));↵ | |
13 | mappingObjects.add(object);↵ | 13 | mappingObjects.add(object);↵ | |
14 | }↵ | 14 | }↵ | |
15 | else if (mappingRoot.isInputObject(object) || mappingRoot.isOutputObject(object))↵ | 15 | else if (mappingRoot.isInputObject(object) || mappingRoot.isOutputObject(object))↵ | |
16 | {↵ | 16 | {↵ | |
17 | mappedObjects.add(object);↵ | 17 | mappedObjects.add(object);↵ | |
18 | }↵ | 18 | }↵ | |
19 | }↵ | 19 | }↵ | |
20 | if (!mappedObjects.isEmpty())↵ | 20 | if (!mappedObjects.isEmpty())↵ | |
21 | {↵ | 21 | {↵ | |
22 | Collection<? extends Mapping> mappings = mappingRoot.getAllMappings(mappedObjects);↵ | 22 | Collection<? extends Mapping> mappings = mappingRoot.getAllMappings(mappedObjects);↵ | |
23 | switch (mappings.size())↵ | 23 | switch (mappings.size())↵ | |
24 | {↵ | 24 | {↵ | |
25 | case 0:↵ | 25 | case 0:↵ | |
26 | {↵ | 26 | {↵ | |
27 | createMappingCommand = CreateMappingCommand.create(mappingDomain, mappedObjects);↵ | 27 | createMappingCommand = CreateMappingCommand.create(mappingDomain, mappedObjects);↵ | |
28 | result = appendIfCanExecute(createMappingCommand);↵ | 28 | result = appendIfCanExecute(createMappingCommand);↵ | |
29 | break;↵ | 29 | break;↵ | |
30 | }↵ | 30 | }↵ | |
31 | case 1:↵ | 31 | case 1:↵ | |
32 | {↵ | 32 | {↵ | |
33 | result = appendIfCanExecute(TypeMatchMappingCommand.create(mappingDomain, mappings.iterator().next()));↵ | 33 | result = appendIfCanExecute(NameMatchMappingCommand.create(mappingDomain, mappings.iterator().next()));↵ | |
34 | break;↵ | 34 | break;↵ | |
35 | }↵ | 35 | }↵ | |
36 | default:↵ | 36 | default:↵ | |
37 | {↵ | 37 | {↵ | |
38 | break;↵ | 38 | break;↵ | |
39 | }↵ | 39 | }↵ | |
40 | }↵ | 40 | }↵ | |
41 | }↵ | 41 | }↵ | |
42 | }↵ | 42 | }↵ | |
43 | result = result || !isEmpty();↵ | 43 | result = result || !isEmpty();↵ | |
44 | return result; | 44 |
| |
See real code fragment | See real code fragment |
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.7 |
Clones location | Clones are in different classes having the same super class |
Number of node comparisons | 139 |
Number of mapped statements | 25 |
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) | 39.4 |
Clone type | Type 2 |
ID | Statement | ID | Statement | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | boolean result = false; | 1 | boolean result = false; | ||||||||||||
2 | if (collection != null) | 2 | if (collection != null) | ||||||||||||
3 | Collection<Object> mappedObjects = new HashSet<Object>(); | 3 | Collection<Object> mappedObjects = new HashSet<Object>(); | ||||||||||||
4 | Collection<Object> mappingObjects = new HashSet<Object>(); | 4 | Collection<Object> mappingObjects = new HashSet<Object>(); | ||||||||||||
5 | MappingRoot mappingRoot = mappingDomain.getMappingRoot(); | 5 | MappingRoot mappingRoot = mappingDomain.getMappingRoot(); | ||||||||||||
6 | for (Object object : collection) | 6 | for (Object object : collection) | ||||||||||||
7 | if (object instanceof Mapping) | 7 | if (object instanceof Mapping) | ||||||||||||
8 | appendIfCanExecute(TypeMatchMappingCommand.create(mappingDomain, (Mapping)object)); |
| 8 | appendIfCanExecute(NameMatchMappingCommand.create(mappingDomain, (Mapping)object)); | |||||||||||
9 | mappingObjects.add(object); | 9 | mappingObjects.add(object); | ||||||||||||
10 | else if (mappingRoot.isInputObject(object) || mappingRoot.isOutputObject(object)) | 10 | else if (mappingRoot.isInputObject(object) || mappingRoot.isOutputObject(object)) | ||||||||||||
11 | mappedObjects.add(object); | 11 | mappedObjects.add(object); | ||||||||||||
12 | if (!mappedObjects.isEmpty()) | 12 | if (!mappedObjects.isEmpty()) | ||||||||||||
13 | Collection<?extendsMapping> mappings = mappingRoot.getAllMappings(mappedObjects); | 13 | Collection<?extendsMapping> mappings = mappingRoot.getAllMappings(mappedObjects); | ||||||||||||
14 | switch (mappings.size()) | 14 | switch (mappings.size()) | ||||||||||||
15 | case 0: | 15 | case 0: | ||||||||||||
16 | createMappingCommand = CreateMappingCommand.create(mappingDomain, mappedObjects); | 16 | createMappingCommand = CreateMappingCommand.create(mappingDomain, mappedObjects); | ||||||||||||
17 | result = appendIfCanExecute(createMappingCommand); | 17 | result = appendIfCanExecute(createMappingCommand); | ||||||||||||
18 | break; | 18 | break; | ||||||||||||
19 | case 1: | 19 | case 1: | ||||||||||||
20 | result = appendIfCanExecute(TypeMatchMappingCommand.create(mappingDomain, mappings.iterator().next())); |
| 20 | result = appendIfCanExecute(NameMatchMappingCommand.create(mappingDomain, mappings.iterator().next())); | |||||||||||
21 | break; | 21 | break; | ||||||||||||
22 | default: | 22 | default: | ||||||||||||
23 | break; | 23 | break; | ||||||||||||
24 | result = result || !isEmpty(); | 24 | result = result || !isEmpty(); | ||||||||||||
25 | return result; | 25 | return result; |
Row | Violation |
---|---|
1 | Expression TypeMatchMappingCommand cannot be unified with expression NameMatchMappingCommand , because common superclass org.eclipse.emf.mapping.command.MatchMappingCommand does not declare member(s) public static org.eclipse.emf.common.command.Command create(org.eclipse.emf.mapping.domain.MappingDomain, org.eclipse.emf.mapping.Mapping) |
2 | Expression TypeMatchMappingCommand cannot be unified with expression NameMatchMappingCommand , because common superclass org.eclipse.emf.mapping.command.MatchMappingCommand does not declare member(s) public static org.eclipse.emf.common.command.Command create(org.eclipse.emf.mapping.domain.MappingDomain, org.eclipse.emf.mapping.Mapping) |