it.next(); if (headerItem.isContact()) { // contacts item ContactModelPartial item = (ContactModelPartial) headerItem; addAddress(item.getName(), item); addAddress(item.getLastname(), item); addAddress(item.getFirstname(), item); addAddress(item.getAddress(), item); } else { if (includeGroup) { // group item GroupModelPartial item = (GroupModelPartial) headerItem; addAddress(item.getName(), item); } } } } public void addAddress(String add, IBasicModelPartial item) { if (add != null) { _adds.put(add, item); } } public Object[] getAddresses() { return _adds.keySet().toArray(); } public IBasicModelPartial getHeaderItem(String add) { return (IBasicModelPartial) _adds.get(add); } public void clear() { _adds.clear(); } /** * @see org.frappucino.addresscombobox.ItemProvider#getMatchingItems(java.lang.String) */ public Object[] getMatchingItems(String s) { Object[] items = getAddresses(); Vector v = new Vector(); // for each JComboBox item for (int k = 0; k < items.length; k++) { // to lower case String item = items[k].toString().toLowerCase(); // compare if item starts with str if (item.startsWith(s.toLowerCase())) { v.add(item); } } return v.toArray();
it.next(); if (headerItem.isContact()) { // contacts item IContactItem item = (IContactItem) headerItem; addAddress(item.getName(), item); addAddress(item.getFirstName(), item); addAddress(item.getLastName(), item); addAddress(item.getEmailAddress(), item); } else { if (includeGroup) { // group item IGroupItem item = (IGroupItem) headerItem; addAddress(item.getName(), item); } } } } public void addAddress(String add, IHeaderItem item) { if (add != null) { _adds.put(add, item); } } public Object[] getAddresses() { return _adds.keySet().toArray(); } public IHeaderItem getHeaderItem(String add) { return (IHeaderItem) _adds.get(add); } public void clear() { _adds.clear(); } /** * @see org.frappucino.addresscombobox.ItemProvider#getMatchingItems(java.lang.String) */ public Object[] getMatchingItems(String s) { Object[] items = getAddresses(); Vector v = new Vector(); // for each JComboBox item for (int k = 0; k < items.length; k++) { // to lower case String item = items[k].toString().toLowerCase(); // compare if item starts with str if (item.startsWith(s.toLowerCase())) { v.add(item); } } return v.toArray();
Clone fragments detected by clone detection tool
File path: /columba-1.4-src/contact/src/main/java/org/columba/addressbook/gui/autocomplete/AddressCollector.java File path: /columba-1.4-src/mail/src/main/java/org/columba/mail/gui/composer/util/AddressCollector.java
Method name: Method name:
Number of AST nodes: 0 Number of AST nodes: 0
1
it.next();
1
it.next();
2
			if (headerItem.isContact()) {
2
			if (headerItem.isContact()) {
3
				// contacts item
3
				// contacts item
4
				ContactModelPartial item = (ContactModelPartial) headerItem;
4
				IContactItem item = (IContactItem) headerItem;
5
				addAddress(item.getName(), item);
5
				addAddress(item.getName(), item);
6
				addAddress(item.getLastname(), item);
6
				addAddress(item.getFirstName(), item);
7
				addAddress(item.getFirstname(), item);
7
				addAddress(item.getLastName(), item);
8
				addAddress(item.getAddress(), item);
8
				addAddress(item.getEmailAddress(), item);
9
			} else {
9
			} else {
10
				if (includeGroup) {
10
				if (includeGroup) {
11
					// group item
11
					// group item
12
					GroupModelPartial item = (GroupModelPartial) headerItem;
12
					IGroupItem item = (IGroupItem) headerItem;
13
					addAddress(item.getName(), item);
13
					addAddress(item.getName(), item);
14
				}
14
				}
15
			}
15
			}
16
		}
16
		}
17
	}
17
	}
18
	public void addAddress(String add, IBasicModelPartial item) {
18
	public void addAddress(String add, IHeaderItem item) {
19
		if (add != null) {
19
		if (add != null) {
20
			_adds.put(add, item);
20
			_adds.put(add, item);
21
		}
21
		}
22
	}
22
	}
23
	public Object[] getAddresses() {
23
	public Object[] getAddresses() {
24
		return _adds.keySet().toArray();
24
		return _adds.keySet().toArray();
25
	}
25
	}
26
	public IBasicModelPartial getHeaderItem(String add) {
26
	public IHeaderItem getHeaderItem(String add) {
27
		return (IBasicModelPartial) _adds.get(add);
27
		return (IHeaderItem) _adds.get(add);
28
	}
28
	}
29
	public void clear() {
29
	public void clear() {
30
		_adds.clear();
30
		_adds.clear();
31
	}
31
	}
32
	/**
32
	/**
33
	 * @see org.frappucino.addresscombobox.ItemProvider#getMatchingItems(java.lang.String)
33
	 * @see org.frappucino.addresscombobox.ItemProvider#getMatchingItems(java.lang.String)
34
	 */
34
	 */
35
	public Object[] getMatchingItems(String s) {
35
	public Object[] getMatchingItems(String s) {
36
		Object[] items = getAddresses();
36
		Object[] items = getAddresses();
37
		Vector v = new Vector();
37
		Vector v = new Vector();
38
		// for each JComboBox item
38
		//		 for each JComboBox item
39
		for (int k = 0; k < items.length; k++) {
39
		for (int k = 0; k < items.length; k++) {
40
			// to lower case
40
			// to lower case
41
			String item = items[k].toString().toLowerCase();
41
			String item = items[k].toString().toLowerCase();
42
			// compare if item starts with str
42
			// compare if item starts with str
43
			if (item.startsWith(s.toLowerCase())) {
43
			if (item.startsWith(s.toLowerCase())) {
44
				v.add(item);
44
				v.add(item);
45
			}
45
			}
46
		}
46
		}
47
		return v.toArray();
47
		return v.toArray();
48
	
48
	
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