File path: /jfreechart-1.0.10/src/org/jfree/chart/renderer/category/BarRenderer.java | File path: /jfreechart-1.0.10/src/org/jfree/chart/renderer/category/GroupedStackedBarRenderer.java | |||
Method name: void calculateBarWidth(CategoryPlot, Rectangle2D, int, CategoryItemRendererState)
|
Method name: void calculateBarWidth(CategoryPlot, Rectangle2D, int, CategoryItemRendererState)
|
|||
Number of AST nodes: 20 | Number of AST nodes: 21 | |||
1 | if (dataset != null) {↵ | 1 | if (data != null) {↵ | |
2 | int columns = dataset.getColumnCount();↵ | 2 | ↵ | |
3 | int rows = dataset.getRowCount();↵ | |||
4 | double space = 0.0;↵ | |||
5 | PlotOrientation orientation = plot.getOrientation()↵ | 3 | PlotOrientation orientation = plot.getOrientation();↵ | |
6 | ;↵ | 4 | double space = 0.0;↵ | |
7 | if (orientation == PlotOrientation.HORIZONTAL) {↵ | 5 | if (orientation == PlotOrientation.HORIZONTAL) {↵ | |
8 | space = dataArea.getHeight();↵ | 6 | space = dataArea.getHeight();↵ | |
9 | }↵ | 7 | }↵ | |
10 | else if (orientation == PlotOrientation.VERTICAL) {↵ | 8 | else if (orientation == PlotOrientation.VERTICAL) {↵ | |
11 | space = dataArea.getWidth();↵ | 9 | space = dataArea.getWidth();↵ | |
12 | }↵ | 10 | }↵ | |
13 | double maxWidth = space * getMaximumBarWidth();↵ | 11 | double maxWidth = space * getMaximumBarWidth();↵ | |
12 | int groups = this.seriesToGroupMap.getGroupCount();↵ | |||
13 | int categories = data.getColumnCount();↵ | |||
14 | int columns = groups * categories;↵ | |||
14 | double categoryMargin = 0.0;↵ | 15 | double categoryMargin = 0.0;↵ | |
15 | double currentItemMargin = 0.0;↵ | 16 | double itemMargin = 0.0;↵ | |
16 | if (columns > 1) {↵ | 17 | if (categories > 1) {↵ | |
17 | categoryMargin = domainAxis.getCategoryMargin();↵ | 18 | categoryMargin = xAxis.getCategoryMargin();↵ | |
18 | }↵ | 19 | }↵ | |
19 | if (rows > 1) {↵ | 20 | if (groups > 1) {↵ | |
20 | currentItemMargin = getItemMargin();↵ | 21 | itemMargin = getItemMargin();↵ | |
21 | }↵ | 22 | }↵ | |
22 | double used = space * (1 - domainAxis.getLowerMargin()↵ | 23 | double used = space * (1 - xAxis.getLowerMargin()↵ | |
23 | - domainAxis.getUpperMargin()↵ | 24 | - xAxis.getUpperMargin()↵ | |
24 | - categoryMargin - currentItemMargin);↵ | 25 | - categoryMargin - itemMargin);↵ | |
25 | if ((rows * columns) > 0) {↵ | 26 | if (columns > 0) {↵ | |
26 | state.setBarWidth(Math.min(used / (rows * columns), maxWidth));↵ | 27 | state.setBarWidth(Math.min(used / columns, maxWidth));↵ | |
27 | }↵ | 28 | }↵ | |
28 | else {↵ | 29 | else {↵ | |
29 | state.setBarWidth(Math.min(used, maxWidth));↵ | 30 | state.setBarWidth(Math.min(used, maxWidth));↵ | |
30 | }↵ | 31 | }↵ | |
31 | } | 32 |
| |
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) | 1.9 |
Clones location | Clones are in different classes having the same super class |
Number of node comparisons | 151 |
Number of mapped statements | 18 |
Number of unmapped statements in the first code fragment | 2 |
Number of unmapped statements in the second code fragment | 3 |
Time elapsed for statement mapping (ms) | 15.3 |
Clone type | Type 3 |
ID | Statement | ID | Statement | |||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
3 | if (dataset != null) |
| 3 | if (data != null) | ||||||||||||||||||
4 | int columns = dataset.getColumnCount(); |
| | |||||||||||||||||||
5 | int rows = dataset.getRowCount(); |
| | |||||||||||||||||||
6 | double space = 0.0; | 5 | double space = 0.0; | |||||||||||||||||||
7 | PlotOrientation orientation = plot.getOrientation(); | 4 | PlotOrientation orientation = plot.getOrientation(); | |||||||||||||||||||
8 | if (orientation == PlotOrientation.HORIZONTAL) | 6 | if (orientation == PlotOrientation.HORIZONTAL) | |||||||||||||||||||
9 | space = dataArea.getHeight(); | 7 | space = dataArea.getHeight(); | |||||||||||||||||||
10 | else if (orientation == PlotOrientation.VERTICAL) | 8 | else if (orientation == PlotOrientation.VERTICAL) | |||||||||||||||||||
11 | space = dataArea.getWidth(); | 9 | space = dataArea.getWidth(); | |||||||||||||||||||
12 | double maxWidth = space * getMaximumBarWidth(); | 10 | double maxWidth = space * getMaximumBarWidth(); | |||||||||||||||||||
| 11 | int groups = this.seriesToGroupMap.getGroupCount(); | ||||||||||||||||||||
|
| 12 | int categories = data.getColumnCount(); | |||||||||||||||||||
| 13 | int columns = groups * categories; | ||||||||||||||||||||
13 | double categoryMargin = 0.0; |
| 15 | double itemMargin = 0.0; | ||||||||||||||||||
14 | double currentItemMargin = 0.0; |
| 14 | double categoryMargin = 0.0; | ||||||||||||||||||
15 | if (columns > 1) |
| 16 | if (categories > 1) | ||||||||||||||||||
16 | categoryMargin = domainAxis.getCategoryMargin(); |
| 17 | categoryMargin = xAxis.getCategoryMargin(); | ||||||||||||||||||
17 | if (rows > 1) |
| 18 | if (groups > 1) | ||||||||||||||||||
18 | currentItemMargin = getItemMargin(); |
| 19 | itemMargin = getItemMargin(); | ||||||||||||||||||
19 | double used = space * (1 - domainAxis.getLowerMargin() - domainAxis.getUpperMargin() - categoryMargin - currentItemMargin); |
| 20 | double used = space * (1 - xAxis.getLowerMargin() - xAxis.getUpperMargin() - categoryMargin - itemMargin); | ||||||||||||||||||
20 | if ((rows * columns) > 0) |
| 21 | if (columns > 0) | ||||||||||||||||||
21 | state.setBarWidth(Math.min(used / (rows * columns), maxWidth)); |
| 22 | state.setBarWidth(Math.min(used / columns, maxWidth)); | ||||||||||||||||||
else | else | |||||||||||||||||||||
22 | state.setBarWidth(Math.min(used, maxWidth)); | 23 | state.setBarWidth(Math.min(used, maxWidth)); |
Row | Violation |
---|---|
1 | Unmatched statement int columns=dataset.getColumnCount(); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted |
2 | Unmatched statement int rows=dataset.getRowCount(); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted |
3 | Unmatched statement int categories=data.getColumnCount(); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted |
4 | Expression currentItemMargin cannot be parameterized, because it has dependencies to/from statements that will be extracted |
5 | Expression itemMargin cannot be parameterized, because it has dependencies to/from statements that will be extracted |
6 | Expression currentItemMargin cannot be parameterized, because it has dependencies to/from statements that will be extracted |
7 | Expression itemMargin cannot be parameterized, because it has dependencies to/from statements that will be extracted |
8 | Expression (rows * columns) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
9 | Expression columns cannot be parameterized, because it has dependencies to/from statements that will be extracted |
10 | Expression (rows * columns) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
11 | Expression columns cannot be parameterized, because it has dependencies to/from statements that will be extracted |