class SetProxy implements java.util.Set { final Collection set; SetProxy(Collection set) { this.set=set; } public boolean add(Object o) { write(); return set.add(o); } public boolean addAll(Collection c) { write(); return set.addAll(c); } public void clear() { write(); set.clear(); } public boolean contains(Object o) { return set.contains(o); } public boolean containsAll(Collection c) { return set.containsAll(c); } public boolean isEmpty() { return set.isEmpty(); } public Iterator iterator() { return new IteratorProxy( set.iterator() ); } public boolean remove(Object o) { write(); return set.remove(o); } public boolean removeAll(Collection c) { write(); return set.removeAll(c); } public boolean retainAll(Collection c) { write(); return set.retainAll(c); } public int size() { return set.size(); } public Object[] toArray() { return set.toArray(); } public Object[] toArray(Object[] array) { return set.toArray(array);
class EntrySetProxy implements Set { private final Set set; EntrySetProxy(Set set) { this.set=set; } public boolean add(Object entry) { //write(); -- doesn't return set.add(entry); } public boolean addAll(Collection entries) { //write(); -- doesn't return set.addAll(entries); } public void clear() { write(); set.clear(); } public boolean contains(Object entry) { return set.contains(entry); } public boolean containsAll(Collection entries) { return set.containsAll(entries); } public boolean isEmpty() { return set.isEmpty(); } public Iterator iterator() { return new EntryIteratorProxy( set.iterator() ); } public boolean remove(Object entry) { write(); return set.remove(entry); } public boolean removeAll(Collection entries) { write(); return set.removeAll(entries); } public boolean retainAll(Collection entries) { write(); return set.retainAll(entries); } public int size() { return set.size(); } // amazingly, these two will work because AbstractCollection // uses iterator() to fill the array public Object[] toArray() { return set.toArray(); } public Object[] toArray(Object[] array) { return set.toArray(array);
Clone fragments detected by clone detection tool
File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/collection/AbstractPersistentCollection.java File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/collection/PersistentMap.java
Method name: Method name:
Number of AST nodes: 0 Number of AST nodes: 0
1
class SetProxy implements java.util.Set {
1
class EntrySetProxy implements Set {
2
		final Collection set;
2
		private final Set set;
3
		SetProxy(Collection set) {
3
		EntrySetProxy(Set set) {
4
			this.set=set;
4
			this.set=set;
5
		}
5
		}
6
		public boolean add(Object o) {
6
		public boolean add(Object entry) {
7
			write();
7
			//write(); -- doesn't
8
			return set.add(o);
8
			return set.add(entry);
9
		}
9
		}
10
		public boolean addAll(Collection c) {
10
		public boolean addAll(Collection entries) {
11
			write();
11
			//write(); -- doesn't
12
			return set.addAll(c);
12
			return set.addAll(entries);
13
		}
13
		}
14
		public void clear() {
14
		public void clear() {
15
			write();
15
			write();
16
			set.clear();
16
			set.clear();
17
		}
17
		}
18
		public boolean contains(Object o) {
18
		public boolean contains(Object entry) {
19
			return set.contains(o);
19
			return set.contains(entry);
20
		}
20
		}
21
		public boolean containsAll(Collection c) {
21
		public boolean containsAll(Collection entries) {
22
			return set.containsAll(c);
22
			return set.containsAll(entries);
23
		}
23
		}
24
		public boolean isEmpty() {
24
		public boolean isEmpty() {
25
			return set.isEmpty();
25
			return set.isEmpty();
26
		}
26
		}
27
		public Iterator iterator() {
27
		public Iterator iterator() {
28
			return new IteratorProxy( set.iterator() );
28
			return new EntryIteratorProxy( set.iterator() );
29
		}
29
		}
30
		public boolean remove(Object o) {
30
		public boolean remove(Object entry) {
31
			write();
31
			write();
32
			return set.remove(o);
32
			return set.remove(entry);
33
		}
33
		}
34
		public boolean removeAll(Collection c) {
34
		public boolean removeAll(Collection entries) {
35
			write();
35
			write();
36
			return set.removeAll(c);
36
			return set.removeAll(entries);
37
		}
37
		}
38
		public boolean retainAll(Collection c) {
38
		public boolean retainAll(Collection entries) {
39
			write();
39
			write();
40
			return set.retainAll(c);
40
			return set.retainAll(entries);
41
		}
41
		}
42
		public int size() {
42
		public int size() {
43
			return set.size();
43
			return set.size();
44
		}
44
		}
45
		// amazingly, these two will work because AbstractCollection
46
		// uses iterator() to fill the array
45
		public Object[] toArray() {
47
		public Object[] toArray() {
46
			return set.toArray();
48
			return set.toArray();
47
		}
49
		}
48
		public Object[] toArray(Object[] array) {
50
		public Object[] toArray(Object[] array) {
49
			return set.toArray(array);
51
			return set.toArray(array);
50
		
52
		
Summary
Number of common nesting structure subtrees0
Number of refactorable cases0
Number of non-refactorable cases0
Time elapsed for finding largest common nesting structure subtrees (ms)0.0
Clones location
Number of node comparisons0