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: 18 | Number of AST nodes: 18 | |||
1 | CategoryAxis xAxis = plot.getDomainAxisForDataset(rendererIndex);↵ | 1 | CategoryAxis domainAxis = getDomainAxis(plot, rendererIndex);↵ | |
2 | CategoryDataset data = plot.getDataset(rendererIndex);↵ | 2 | CategoryDataset data = plot.getDataset(rendererIndex);↵ | |
3 | if (data != null) {↵ | 3 | if (data != null) {↵ | |
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 | }↵ | 8 | }↵ | |
9 | else if (orientation == PlotOrientation.VERTICAL) {↵ | 9 | else if (orientation == PlotOrientation.VERTICAL) {↵ | |
10 | space = dataArea.getWidth();↵ | 10 | space = dataArea.getWidth();↵ | |
11 | }↵ | 11 | }↵ | |
12 | double maxWidth = space * getMaximumBarWidth();↵ | 12 | double maxWidth = space * getMaximumBarWidth();↵ | |
13 | int columns = data.getColumnCount();↵ | 13 | int columns = data.getColumnCount();↵ | |
14 | double categoryMargin = 0.0;↵ | 14 | double categoryMargin = 0.0;↵ | |
15 | if (columns > 1) {↵ | 15 | if (columns > 1) {↵ | |
16 | categoryMargin = xAxis.getCategoryMargin();↵ | 16 | categoryMargin = domainAxis.getCategoryMargin();↵ | |
17 | }↵ | 17 | }↵ | |
18 | double used = space * (1 - xAxis.getLowerMargin()↵ | 18 | double used = space * (1 - domainAxis.getLowerMargin()↵ | |
19 | - xAxis.getUpperMargin()↵ | 19 | - domainAxis.getUpperMargin()↵ | |
20 | - categoryMargin);↵ | 20 | - categoryMargin);↵ | |
21 | if (columns > 0) {↵ | 21 | if (columns > 0) {↵ | |
22 | state.setBarWidth(Math.min(used / columns, maxWidth));↵ | 22 | state.setBarWidth(Math.min(used / columns, maxWidth));↵ | |
23 | }↵ | 23 | }↵ | |
24 | else {↵ | 24 | else {↵ | |
25 | state.setBarWidth(Math.min(used, maxWidth));↵ | 25 | state.setBarWidth(Math.min(used, maxWidth));↵ | |
26 | }↵ | 26 | }↵ | |
27 | } | 27 |
| |
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.3 |
Clones location | Clones are in different classes having the same super class |
Number of node comparisons | 99 |
Number of mapped statements | 17 |
Number of unmapped statements in the first code fragment | 1 |
Number of unmapped statements in the second code fragment | 1 |
Time elapsed for statement mapping (ms) | 40.7 |
Clone type | Type 2 |
ID | Statement | ID | Statement | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | CategoryAxis domainAxis = getDomainAxis(plot, rendererIndex); | |||||||||||||||
1 | CategoryAxis xAxis = plot.getDomainAxisForDataset(rendererIndex); | | |||||||||||||||
2 | CategoryDataset data = plot.getDataset(rendererIndex); | 2 | CategoryDataset data = plot.getDataset(rendererIndex); | ||||||||||||||
3 | if (data != null) | 3 | if (data != null) | ||||||||||||||
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 |
---|