File path: /jfreechart-1.0.10/tests/org/jfree/data/junit/DefaultKeyedValuesTests.java | File path: /jfreechart-1.0.10/tests/org/jfree/data/junit/DefaultKeyedValuesTests.java | |||
Method name: void testSortByKeyDescending()
|
Method name: void testSortByValueDescending()
|
|||
Number of AST nodes: 18 | Number of AST nodes: 18 | |||
1 | DefaultKeyedValues data = new DefaultKeyedValues();↵ | 1 | DefaultKeyedValues data = new DefaultKeyedValues();↵ | |
2 | data.addValue("C", new Double(1.0));↵ | 2 | data.addValue("C", new Double(1.0));↵ | |
3 | data.addValue("B", null);↵ | 3 | data.addValue("B", null);↵ | |
4 | data.addValue("D", new Double(3.0));↵ | 4 | data.addValue("D", new Double(3.0));↵ | |
5 | data.addValue("A", new Double(2.0));↵ | 5 | data.addValue("A", new Double(2.0));↵ | |
6 | data.sortByKeys(SortOrder.DESCENDING);↵ | 6 | data.sortByValues(SortOrder.DESCENDING);↵ | |
7 | // check key order↵ | 7 | // check key order↵ | |
8 | assertEquals(data.getKey(0), "D");↵ | 8 | assertEquals(data.getKey(0), "D");↵ | |
9 | assertEquals(data.getKey(1), "C");↵ | 9 | assertEquals(data.getKey(1), "A");↵ | |
10 | assertEquals(data.getKey(2), "B");↵ | 10 | assertEquals(data.getKey(2), "C");↵ | |
11 | assertEquals(data.getKey(3), "A");↵ | 11 | assertEquals(data.getKey(3), "B");↵ | |
12 | // check retrieve value by key↵ | 12 | // check retrieve value by key↵ | |
13 | assertEquals(data.getValue("A"), new Double(2.0));↵ | 13 | assertEquals(data.getValue("A"), new Double(2.0));↵ | |
14 | assertEquals(data.getValue("B"), null);↵ | 14 | assertEquals(data.getValue("B"), null);↵ | |
15 | assertEquals(data.getValue("C"), new Double(1.0));↵ | 15 | assertEquals(data.getValue("C"), new Double(1.0));↵ | |
16 | assertEquals(data.getValue("D"), new Double(3.0));↵ | 16 | assertEquals(data.getValue("D"), new Double(3.0));↵ | |
17 | // check retrieve value by index↵ | 17 | // check retrieve value by index↵ | |
18 | assertEquals(data.getValue(0), new Double(3.0));↵ | 18 | assertEquals(data.getValue(0), new Double(3.0));↵ | |
19 | assertEquals(data.getValue(1), new Double(1.0));↵ | 19 | assertEquals(data.getValue(1), new Double(2.0));↵ | |
20 | assertEquals(data.getValue(2), null);↵ | 20 | assertEquals(data.getValue(2), new Double(1.0));↵ | |
21 | assertEquals(data.getValue(3), new Double(2.0)); | 21 | assertEquals(data.getValue(3), null); | |
See real code fragment | See real code fragment |
Number of common nesting structure subtrees | 1 |
Number of refactorable cases | 1 |
Number of non-refactorable cases | 0 |
Time elapsed for finding largest common nesting structure subtrees (ms) | 0.0 |
Clones location | Clones are declared in the same class |
Number of node comparisons | 180 |
Number of mapped statements | 18 |
Number of unmapped statements in the first code fragment | 0 |
Number of unmapped statements in the second code fragment | 0 |
Time elapsed for statement mapping (ms) | 0.0 |
Clone type | Type 2 |
ID | Statement | ID | Statement | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | DefaultKeyedValues data = new DefaultKeyedValues(); | 1 | DefaultKeyedValues data = new DefaultKeyedValues(); | |||||||||||||||
2 | data.addValue("C", new Double(1.0)); | 2 | data.addValue("C", new Double(1.0)); | |||||||||||||||
3 | data.addValue("B", null); | 3 | data.addValue("B", null); | |||||||||||||||
4 | data.addValue("D", new Double(3.0)); | 4 | data.addValue("D", new Double(3.0)); | |||||||||||||||
5 | data.addValue("A", new Double(2.0)); | 5 | data.addValue("A", new Double(2.0)); | |||||||||||||||
6 | data.sortByKeys(SortOrder.DESCENDING); |
| 6 | data.sortByValues(SortOrder.DESCENDING); | ||||||||||||||
7 | assertEquals(data.getKey(0), "D"); | 7 | assertEquals(data.getKey(0), "D"); | |||||||||||||||
8 | assertEquals(data.getKey(1), "C"); |
| 9 | assertEquals(data.getKey(2), "C"); | ||||||||||||||
9 | assertEquals(data.getKey(2), "B"); |
| 10 | assertEquals(data.getKey(3), "B"); | ||||||||||||||
10 | assertEquals(data.getKey(3), "A"); |
| 8 | assertEquals(data.getKey(1), "A"); | ||||||||||||||
11 | assertEquals(data.getValue("A"), new Double(2.0)); | 11 | assertEquals(data.getValue("A"), new Double(2.0)); | |||||||||||||||
12 | assertEquals(data.getValue("B"), null); | 12 | assertEquals(data.getValue("B"), null); | |||||||||||||||
13 | assertEquals(data.getValue("C"), new Double(1.0)); | 13 | assertEquals(data.getValue("C"), new Double(1.0)); | |||||||||||||||
14 | assertEquals(data.getValue("D"), new Double(3.0)); | 14 | assertEquals(data.getValue("D"), new Double(3.0)); | |||||||||||||||
15 | assertEquals(data.getValue(0), new Double(3.0)); | 15 | assertEquals(data.getValue(0), new Double(3.0)); | |||||||||||||||
16 | assertEquals(data.getValue(1), new Double(1.0)); |
| 17 | assertEquals(data.getValue(2), new Double(1.0)); | ||||||||||||||
17 | assertEquals(data.getValue(2), null); |
| 18 | assertEquals(data.getValue(3), null); | ||||||||||||||
18 | assertEquals(data.getValue(3), new Double(2.0)); |
| 16 | assertEquals(data.getValue(1), new Double(2.0)); |
Row | Violation |
---|---|
1 | Expression data.sortByKeys(SortOrder.DESCENDING) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
2 | Expression data.sortByValues(SortOrder.DESCENDING) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
3 | Expression data.sortByKeys(SortOrder.DESCENDING) is a void method call, and thus it cannot be parameterized |
4 | Expression data.sortByValues(SortOrder.DESCENDING) is a void method call, and thus it cannot be parameterized |