Date date = transformDate(pattern);
if (date == null)
return false;
boolean result = false;
// get date
Date d = (Date) ((IMailbox)folder).getAttribute(uid, "columba.date");
if (d == null) {
LOG.fine("field date not found");
return false;
}
switch (condition) {
case FilterCriteria.DATE_BEFORE:
if (d.before(date)) {
result = true;
}
break;
case FilterCriteria.DATE_AFTER:
if (d.after(date)) {
result = true;
}
break;
}
return result;
boolean result = false;
String s = (String) searchPattern;
Integer searchPatternInt = transformPriority(s);
Integer priority = (Integer) ((IMailbox)folder).getAttribute(uid,
"columba.priority");
if (priority == null) {
return false;
}
switch (condition) {
case FilterCriteria.IS:
if (priority.compareTo(searchPatternInt) == 0) {
result = true;
}
break;
case FilterCriteria.IS_NOT:
if (priority.compareTo(searchPatternInt) != 0) {
result = true;
}
break;
}
return result;
Clone fragments detected by clone detection tool
File path: /columba-1.4-src/mail/src/main/java/org/columba/mail/filter/plugins/DateFilter.java
|
|
File path: /columba-1.4-src/mail/src/main/java/org/columba/mail/filter/plugins/PriorityFilter.java
|
Method name: boolean process(IFolder, Object)
|
|
Method name: boolean process(IFolder, Object)
|
Number of AST nodes: 18
|
|
Number of AST nodes: 16
|
|
1 | Date date↵ | | 1 | boolean result = false;↵
|
|
2 | = transformDate(pattern);↵ | | 2 | String s = (String) searchPattern;↵
|
3 | if (date == null)↵ | | 3 | ↵
|
4 | return false;↵ | | |
|
|
5 | boolean result = false;↵ | | 4 | Integer searchPatternInt = transformPriority(s);↵
|
|
6 | // get date↵ | | 5 | ↵
|
7 | Date d = (Date) ((IMailbox)folder).getAttribute(uid, ↵ | | 6 | Integer priority = (Integer) ((IMailbox)folder).getAttribute(uid,↵
|
8 | "columba.date");↵ | | 7 | "columba.priority");↵
|
|
9 | if (d == null) {↵ | | 8 | if (priority == null) {↵
|
10 | LOG.fine("field date not found");↵ | | |
|
|
11 | return false;↵ | | 9 | return false;↵
|
12 | }↵ | | 10 | }↵
|
|
13 | switch (condition) {↵ | | 11 | switch (condition) {↵
|
14 | case FilterCriteria.DATE_BEFORE:↵ | | 12 | case FilterCriteria.↵
|
|
15 | if (d.before(date)↵ | | 13 | IS:↵
|
|
16 | ) {↵ | | 14 | if (priority.compareTo(searchPatternInt) == 0) {↵
|
17 | result = true;↵ | | 15 | result = true;↵
|
18 | }↵ | | 16 | }↵
|
|
19 | break;↵ | | 17 | break;↵
|
|
20 | case FilterCriteria.DATE_AFTER:↵ | | 18 | case FilterCriteria.↵
|
|
21 | if (d.after(date)↵ | | 19 | IS_NOT:↵
|
|
22 | ) {↵ | | 20 | if (priority.compareTo(searchPatternInt) != 0) {↵
|
23 | result = true;↵ | | 21 | result = true;↵
|
24 | }↵ | | 22 | }↵
|
|
25 | break;↵ | | 23 | break;↵
|
26 | }↵ | | 24 | }↵
|
|
27 | return result; | | 25 | return result;
|
See real code fragment |
|
See real code fragment |
Summary
Number of common nesting structure subtrees | 0 |
Number of refactorable cases | 0 |
Number of non-refactorable cases | 0 |
Time elapsed for finding largest common nesting structure subtrees (ms) | 0.2 |
Clones location | Clones are in different classes having the same super class |
Number of node comparisons | 4 |