IComponentInfoList list = new ComponentInfoList(); Iterator it = dataStorage.iterator(); while (it.hasNext()) { Document document = (Document) it.next(); IComponentInfo basicModel = null; try { basicModel = VCalendarModelFactory.unmarshall(document); } catch (SyntaxException e) { throw new StoreException(e); } catch (IllegalArgumentException e) { throw new StoreException(e); } if (basicModel.getType() == IComponent.TYPE.EVENT) { IEventInfo event = (IEventInfo) basicModel; list.add(event); } } return list;
ArrayList<String> result = new ArrayList<String>(); Iterator it = dataStorage.iterator(); while (it.hasNext()) { Document document = (Document) it.next(); IComponentInfo basicModel = null; try { basicModel = VCalendarModelFactory.unmarshall(document); } catch (SyntaxException e) { throw new StoreException(e); } catch (IllegalArgumentException e) { throw new StoreException(e); } if (basicModel.getType() == IComponent.TYPE.EVENT) { IEventInfo event = (IEventInfo) basicModel; result.add(event.getId()); } } return result.iterator();
Clone fragments detected by clone detection tool
File path: /columba-1.4-src/calendar/src/main/java/org/columba/calendar/store/LocalCalendarStore.java File path: /columba-1.4-src/calendar/src/main/java/org/columba/calendar/store/LocalCalendarStore.java
Method name: IComponentInfoList getComponentInfoList() Method name: Iterator getIdIterator()
Number of AST nodes: 11 Number of AST nodes: 11
1
IComponentInfoList list = new ComponentInfoList();
1
ArrayList<String> result = new ArrayList<String>();
2
		Iterator it = dataStorage.iterator();
2
		Iterator it = dataStorage.iterator();
3
		while (it.hasNext()) {
3
		while (it.hasNext()) {
4
			Document document = (Document) it.next();
4
			Document document = (Document) it.next();
5
			IComponentInfo basicModel = null;
5
			IComponentInfo basicModel = null;
6
			try {
6
			try {
7
				basicModel = VCalendarModelFactory.unmarshall(document);
7
				basicModel = VCalendarModelFactory.unmarshall(document);
8
			} catch (SyntaxException e) {
8
			} catch (SyntaxException e) {
9
				throw new StoreException(e);
9
				throw new StoreException(e);
10
			} catch (IllegalArgumentException e) {
10
			} catch (IllegalArgumentException e) {
11
				throw new StoreException(e);
11
				throw new StoreException(e);
12
			}
12
			}
13
			if (basicModel.getType() == IComponent.TYPE.EVENT) {
13
			if (basicModel.getType() == IComponent.TYPE.EVENT) {
14
				IEventInfo event = (IEventInfo) basicModel;
14
				IEventInfo event = (IEventInfo) basicModel;
15
				list.add(event);
15
				result.add(event.getId());
16
			}
16
			}
17
		}
17
		}
18
		return list;
18
		return result.iterator();
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.7
Clones locationClones are declared in the same class
Number of node comparisons33
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements8
    Number of unmapped statements in the first code fragment3
    Number of unmapped statements in the second code fragment3
    Time elapsed for statement mapping (ms)27.0
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
                                                                                                            
    1
    ArrayList<String> result = new ArrayList<String>();
    1
    IComponentInfoList list = new ComponentInfoList();
                                                                                                          
    2
    Iterator it = dataStorage.iterator();
    2
    Iterator it = dataStorage.iterator();
    3
    while (it.hasNext())
    3
    while (it.hasNext())
    4
    Document document = (Document)it.next();
    4
    Document document = (Document)it.next();
    5
    IComponentInfo basicModel = null;
    5
    IComponentInfo basicModel = null;
    6
    try
    6
    try
    7
    basicModel = VCalendarModelFactory.unmarshall(document);
    7
    basicModel = VCalendarModelFactory.unmarshall(document);
    8
    if (basicModel.getType() == IComponent.TYPE.EVENT)
    8
    if (basicModel.getType() == IComponent.TYPE.EVENT)
    9
    IEventInfo event = (IEventInfo)basicModel;
    9
    IEventInfo event = (IEventInfo)basicModel;
                                                                
    10
    result.add(event.getId());
    Preondition Violations
    Unmatched statement result.add(event.getId()); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    10
    result.add(event.getId());
    10
    list.add(event);
    10
    list.add(event);
    Preondition Violations
    Unmatched statement list.add(event); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                            
                                                              
    11
    return result.iterator();
    Preondition Violations
    Unmatched return result.iterator();
    11
    return result.iterator();
    11
    return list;
    11
    return list;
    Preondition Violations
    Unmatched return list;
                                    
    Precondition Violations (4)
    Row Violation
    1Unmatched statement result.add(event.getId()); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    2Unmatched statement list.add(event); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3Unmatched return result.iterator();
    4Unmatched return list;