File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/collection/PersistentSet.java | File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/collection/PersistentSet.java | |||
Method name: boolean add(Object)
|
Method name: boolean remove(Object)
|
|||
Number of AST nodes: 10 | Number of AST nodes: 10 | |||
1 | if ( exists == null ) {↵ | 1 | if ( exists==null ) {↵ | |
2 | initialize( true );↵ | 2 | initialize( true );↵ | |
3 | if ( set.add( value ) ) {↵ | 3 | if ( set.remove( value ) ) {↵ | |
4 | dirty();↵ | 4 | dirty();↵ | |
5 | return true;↵ | 5 | return true;↵ | |
6 | }↵ | 6 | }↵ | |
7 | else {↵ | 7 | else {↵ | |
8 | return false;↵ | 8 | return false;↵ | |
9 | }↵ | 9 | }↵ | |
10 | }↵ | 10 | }↵ | |
11 | else if ( exists.booleanValue() ) {↵ | 11 | else if ( exists.booleanValue() ) {↵ | |
12 | return false;↵ | 12 | ↵ | |
13 | }↵ | |||
14 | else {↵ | |||
15 | queueOperation( new SimpleAdd(value) );↵ | 13 | queueOperation( new SimpleRemove(value) );↵ | |
16 | return true;↵ | 14 | return true;↵ | |
17 | } | 15 | }↵ | |
16 | else {↵ | |||
17 | return false;↵ | |||
18 |
| |||
See real code fragment | See real code fragment |
Number of common nesting structure subtrees | 1 |
Number of refactorable cases | 1 |
Number of non-refactorable cases | 0 |
Time elapsed for finding largest common nesting structure subtrees (ms) | 0.3 |
Clones location | Clones are declared in the same class |
Number of node comparisons | 36 |
Number of mapped statements | 9 |
Number of unmapped statements in the first code fragment | 1 |
Number of unmapped statements in the second code fragment | 1 |
Time elapsed for statement mapping (ms) | 18.2 |
Clone type | Type 3 |
ID | Statement | ID | Statement | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
2 | if (exists == null) | 2 | if (exists == null) | |||||||||||
3 | initialize(true); | 3 | initialize(true); | |||||||||||
4 | if (set.add(value)) |
| 4 | if (set.remove(value)) | ||||||||||
5 | dirty(); | 5 | dirty(); | |||||||||||
6 | return true; | 6 | return true; | |||||||||||
else | else | |||||||||||||
7 | return false; | 7 | return false; | |||||||||||
8 | else if (exists.booleanValue()) | 8 | else if (exists.booleanValue()) | |||||||||||
|
| 9 | queueOperation(new SimpleRemove(value)); | |||||||||||
9 | return false; |
| 10 | return true; | ||||||||||
else | else | |||||||||||||
10 | queueOperation(new SimpleAdd(value)); |
| | |||||||||||
11 | return true; |
| 11 | return false; |
Row | Violation |
---|---|
1 | Unmatched statement queueOperation(new SimpleRemove(value)); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted |
2 | Unmatched statement queueOperation(new SimpleAdd(value)); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted |