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; if (event.getCalendar().equals(calendarId)) { list.add(event); } } }
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; if (event.getCalendar().equals(calendarId)) result.add(event.getId()); } }
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(String) Method name: Iterator getIdIterator(String)
Number of AST nodes: 9 Number of AST nodes: 9
1
while (it.hasNext()) {
1
while (it.hasNext()) {
2
			Document document = (Document) it.next();
2
			Document document = (Document) it.next();
3
			IComponentInfo basicModel = null;
3
			IComponentInfo basicModel = null;
4
			try {
4
			try {
5
				basicModel = VCalendarModelFactory.unmarshall(document);
5
				basicModel = VCalendarModelFactory.unmarshall(document);
6
			} catch (SyntaxException e) {
6
			} catch (SyntaxException e) {
7
				throw new StoreException(e);
7
				throw new StoreException(e);
8
			} catch (IllegalArgumentException e) {
8
			} catch (IllegalArgumentException e) {
9
				throw new StoreException(e);
9
				throw new StoreException(e);
10
			}
10
			}
11
			if (basicModel.getType() == IComponent.TYPE.EVENT) {
11
			if (basicModel.getType() == IComponent.TYPE.EVENT) {
12
				IEventInfo event = (IEventInfo) basicModel;
12
				IEventInfo event = (IEventInfo) basicModel;
13
				if (event.getCalendar().equals(calendarId)) {
13
				if (event.getCalendar().equals(calendarId))
14
					list.add(event);
14
					result.add(event
15
				}
15
.getId());
16
			}
16
			}
17
		}
17
		}
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.4
Clones locationClones are declared in the same class
Number of node comparisons21
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements8
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)10.1
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    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
    if (event.getCalendar().equals(calendarId))
    10
    if (event.getCalendar().equals(calendarId))
                                                                
    11
    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
    11
    result.add(event.getId());
    11
    list.add(event);
    11
    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
                                            
    Precondition Violations (2)
    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