File path: /jfreechart-1.0.10/tests/org/jfree/chart/axis/junit/SegmentedTimelineTests.java | File path: /jfreechart-1.0.10/tests/org/jfree/chart/axis/junit/SegmentedTimelineTests.java | |||
Method name: long[] verifyFillInExceptions(SegmentedTimeline, String[], Format)
|
Method name: void fillInBaseTimelineExceptions(SegmentedTimeline, String[], Format)
|
|||
Number of AST nodes: 11 | Number of AST nodes: 10 | |||
1 | for (int i = 0; i < exceptionString.length; i++) {↵ | 1 | for (int i = 0; i < exceptionString.length; i++) {↵ | |
2 | long e;↵ | 2 | long e;↵ | |
3 | if (fmt instanceof NumberFormat) {↵ | 3 | if (fmt instanceof NumberFormat) {↵ | |
4 | e = ((NumberFormat) fmt).parse(exceptionString[i]).longValue();↵ | 4 | e = ((NumberFormat) fmt).parse(exceptionString[i]).longValue();↵ | |
5 | }↵ | 5 | }↵ | |
6 | else {↵ | 6 | else {↵ | |
7 | e = timeline.getTime(((SimpleDateFormat) fmt)↵ | 7 | e = timeline.getTime(((SimpleDateFormat) fmt)↵ | |
8 | .parse(exceptionString[i]));↵ | 8 | .parse(exceptionString[i]));↵ | |
9 | }↵ | 9 | }↵ | |
10 | // only add an exception if it is currently an included segment↵ | 10 | timeline.addBaseTimelineException(e);↵ | |
11 | // verify all timeline segments included in the ↵ | |||
12 | // baseTimeline.segment are now exceptions↵ | |||
11 | SegmentedTimeline.Segment segment = timeline.getSegment(e);↵ | 13 | SegmentedTimeline.Segment segment1 = baseTimeline.getSegment(e);↵ | |
12 | if (segment.inIncludeSegments()) {↵ | 14 | for (Segment↵ | |
15 | edTimeline.Segment segment2 ↵ | |||
13 | timeline.addException(e);↵ | 16 | = timeline.↵ | |
14 | exceptionList.add(new Long(e));↵ | |||
15 | assertEquals(exceptionList.size(), ↵ | |||
16 | timeline.getException↵ | 17 | getSegment(segment1.getSegmentStart());↵ | |
18 | segment2.getSegmentStart() <= segment1.getSegmentEnd();↵ | |||
19 | segment2.inc()) {↵ | |||
17 | Segments().size());↵ | 20 | if (!segment2.inExcludeSegments()) {↵ | |
18 | assertTrue(segment.inExceptionSegments());↵ | 21 | assertTrue(segment2.inExceptionSegments());↵ | |
19 | }↵ | 22 | }↵ | |
23 | }↵ | |||
20 | } | 24 |
| |
See real code fragment | See real code fragment |
Number of common nesting structure subtrees | 1 |
Number of refactorable cases | 0 |
Number of non-refactorable cases | 1 |
Time elapsed for finding largest common nesting structure subtrees (ms) | 4.1 |
Clones location | Clones are declared in the same class |
Number of node comparisons | 12 |
Number of mapped statements | 2 |
Number of unmapped statements in the first code fragment | 5 |
Number of unmapped statements in the second code fragment | 0 |
Time elapsed for statement mapping (ms) | 16.5 |
Clone type | Type 3 |
ID | Statement | ID | Statement | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
5 | long e; | | |||||||||||||
9 | SegmentedTimeline.Segment segment = timeline.getSegment(e); |
| | ||||||||||||
10 | if (segment.inIncludeSegments()) |
| 10 | if (!segment2.inExcludeSegments()) | |||||||||||
11 | timeline.addException(e); |
| | ||||||||||||
12 | exceptionList.add(new Long(e)); |
| | ||||||||||||
13 | assertEquals(exceptionList.size(), timeline.getExceptionSegments().size()); | | |||||||||||||
14 | assertTrue(segment.inExceptionSegments()); |
| 11 | assertTrue(segment2.inExceptionSegments()); |
Row | Violation |
---|---|
1 | Unmatched statement SegmentedTimeline.Segment segment=timeline.getSegment(e); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
2 | Expression segment.inIncludeSegments() cannot be parameterized, because it has dependencies to/from statements that will be extracted |
3 | Unmatched statement timeline.addException(e); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted |
4 | Unmatched statement timeline.addException(e); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted |
5 | Unmatched statement exceptionList.add(new Long(e)); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted |