File path: /jfreechart-1.0.10/src/org/jfree/chart/renderer/category/StackedBarRenderer.java | File path: /jfreechart-1.0.10/src/org/jfree/chart/renderer/category/StackedBarRenderer3D.java | |||
Method name: void calculateBarWidth(CategoryPlot, Rectangle2D, int, CategoryItemRendererState)
|
Method name: void calculateBarWidth(CategoryPlot, Rectangle2D, int, CategoryItemRendererState)
|
|||
Number of AST nodes: 15 | Number of AST nodes: 15 | |||
1 | PlotOrientation orientation = plot.getOrientation();↵ | 1 | PlotOrientation orientation = plot.getOrientation();↵ | |
2 | double space = 0.0;↵ | 2 | double space = 0.0;↵ | |
3 | if (orientation == PlotOrientation.HORIZONTAL) {↵ | 3 | if (orientation == PlotOrientation.HORIZONTAL) {↵ | |
4 | space = dataArea.getHeight();↵ | 4 | space = dataArea.getHeight();↵ | |
5 | }↵ | 5 | }↵ | |
6 | else if (orientation == PlotOrientation.VERTICAL) {↵ | 6 | else if (orientation == PlotOrientation.VERTICAL) {↵ | |
7 | space = dataArea.getWidth();↵ | 7 | space = dataArea.getWidth();↵ | |
8 | }↵ | 8 | }↵ | |
9 | double maxWidth = space * getMaximumBarWidth();↵ | 9 | double maxWidth = space * getMaximumBarWidth();↵ | |
10 | int columns = data.getColumnCount();↵ | 10 | int columns = data.getColumnCount();↵ | |
11 | double categoryMargin = 0.0;↵ | 11 | double categoryMargin = 0.0;↵ | |
12 | if (columns > 1) {↵ | 12 | if (columns > 1) {↵ | |
13 | categoryMargin = xAxis.getCategoryMargin();↵ | 13 | categoryMargin = domainAxis.getCategoryMargin();↵ | |
14 | }↵ | 14 | }↵ | |
15 | double used = space * (1 - xAxis.getLowerMargin()↵ | 15 | double used = space * (1 - domainAxis.getLowerMargin()↵ | |
16 | - xAxis.getUpperMargin()↵ | 16 | - domainAxis.getUpperMargin()↵ | |
17 | - categoryMargin);↵ | 17 | - categoryMargin);↵ | |
18 | if (columns > 0) {↵ | 18 | if (columns > 0) {↵ | |
19 | state.setBarWidth(Math.min(used / columns, maxWidth));↵ | 19 | state.setBarWidth(Math.min(used / columns, maxWidth));↵ | |
20 | }↵ | 20 | }↵ | |
21 | else {↵ | 21 | else {↵ | |
22 | state.setBarWidth(Math.min(used, maxWidth));↵ | 22 | state.setBarWidth(Math.min(used, maxWidth));↵ | |
23 | } | 23 |
| |
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) | 1.0 |
Clones location | Clones are in different classes having the same super class |
Number of node comparisons | 94 |
Number of mapped statements | 15 |
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) | 3.6 |
Clone type | Type 2 |
ID | Statement | ID | Statement | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
4 | PlotOrientation orientation = plot.getOrientation(); | 4 | PlotOrientation orientation = plot.getOrientation(); | ||||||||||||||
5 | double space = 0.0; | 5 | double space = 0.0; | ||||||||||||||
6 | if (orientation == PlotOrientation.HORIZONTAL) | 6 | if (orientation == PlotOrientation.HORIZONTAL) | ||||||||||||||
7 | space = dataArea.getHeight(); | 7 | space = dataArea.getHeight(); | ||||||||||||||
8 | else if (orientation == PlotOrientation.VERTICAL) | 8 | else if (orientation == PlotOrientation.VERTICAL) | ||||||||||||||
9 | space = dataArea.getWidth(); | 9 | space = dataArea.getWidth(); | ||||||||||||||
10 | double maxWidth = space * getMaximumBarWidth(); | 10 | double maxWidth = space * getMaximumBarWidth(); | ||||||||||||||
11 | int columns = data.getColumnCount(); | 11 | int columns = data.getColumnCount(); | ||||||||||||||
12 | double categoryMargin = 0.0; | 12 | double categoryMargin = 0.0; | ||||||||||||||
13 | if (columns > 1) | 13 | if (columns > 1) | ||||||||||||||
14 | categoryMargin = xAxis.getCategoryMargin(); |
| 14 | categoryMargin = domainAxis.getCategoryMargin(); | |||||||||||||
15 | double used = space * (1 - xAxis.getLowerMargin() - xAxis.getUpperMargin() - categoryMargin); |
| 15 | double used = space * (1 - domainAxis.getLowerMargin() - domainAxis.getUpperMargin() - categoryMargin); | |||||||||||||
16 | if (columns > 0) | 16 | if (columns > 0) | ||||||||||||||
17 | state.setBarWidth(Math.min(used / columns, maxWidth)); | 17 | state.setBarWidth(Math.min(used / columns, maxWidth)); | ||||||||||||||
else | else | ||||||||||||||||
18 | state.setBarWidth(Math.min(used, maxWidth)); | 18 | state.setBarWidth(Math.min(used, maxWidth)); |
Row | Violation |
---|