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/LevelRenderer.java | |||
Method name: void calculateBarWidth(CategoryPlot, Rectangle2D, int, CategoryItemRendererState)
|
Method name: void calculateItemWidth(CategoryPlot, Rectangle2D, int, CategoryItemRendererState)
|
|||
Number of AST nodes: 22 | Number of AST nodes: 22 | |||
1 | CategoryAxis domainAxis = getDomainAxis(plot, rendererIndex);↵ | 1 | CategoryAxis domainAxis = getDomainAxis(plot, rendererIndex);↵ | |
2 | CategoryDataset dataset = plot.getDataset(rendererIndex);↵ | 2 | CategoryDataset dataset = plot.getDataset(rendererIndex);↵ | |
3 | if (dataset != null) {↵ | 3 | if (dataset != null) {↵ | |
4 | int columns = dataset.getColumnCount();↵ | 4 | int columns = dataset.getColumnCount();↵ | |
5 | int rows = dataset.getRowCount();↵ | 5 | int rows = dataset.getRowCount();↵ | |
6 | double space = 0.0;↵ | 6 | double space = 0.0;↵ | |
7 | PlotOrientation orientation = plot.getOrientation();↵ | 7 | PlotOrientation orientation = plot.getOrientation();↵ | |
8 | if (orientation == PlotOrientation.HORIZONTAL) {↵ | 8 | if (orientation == PlotOrientation.HORIZONTAL) {↵ | |
9 | space = dataArea.getHeight();↵ | 9 | space = dataArea.getHeight();↵ | |
10 | }↵ | 10 | }↵ | |
11 | else if (orientation == PlotOrientation.VERTICAL) {↵ | 11 | else if (orientation == PlotOrientation.VERTICAL) {↵ | |
12 | space = dataArea.getWidth();↵ | 12 | space = dataArea.getWidth();↵ | |
13 | }↵ | 13 | }↵ | |
14 | double maxWidth = space * getMaximumBarWidth();↵ | 14 | double maxWidth = space * getMaximumItemWidth();↵ | |
15 | double categoryMargin = 0.0;↵ | 15 | double categoryMargin = 0.0;↵ | |
16 | double currentItemMargin = 0.0;↵ | 16 | double currentItemMargin = 0.0;↵ | |
17 | if (columns > 1) {↵ | 17 | if (columns > 1) {↵ | |
18 | categoryMargin = domainAxis.getCategoryMargin();↵ | 18 | categoryMargin = domainAxis.getCategoryMargin();↵ | |
19 | }↵ | 19 | }↵ | |
20 | if (rows > 1) {↵ | 20 | if (rows > 1) {↵ | |
21 | currentItemMargin = getItemMargin();↵ | 21 | currentItemMargin = getItemMargin();↵ | |
22 | }↵ | 22 | }↵ | |
23 | double used = space * (1 - domainAxis.getLowerMargin()↵ | 23 | double used = space * (1 - domainAxis.getLowerMargin()↵ | |
24 | - domainAxis.getUpperMargin()↵ | 24 | - domainAxis.getUpperMargin()↵ | |
25 | - categoryMargin - currentItemMargin);↵ | 25 | - categoryMargin - currentItemMargin);↵ | |
26 | if ((rows * columns) > 0) {↵ | 26 | if ((rows * columns) > 0) {↵ | |
27 | state.setBarWidth(Math.min(used / (rows * columns), maxWidth));↵ | 27 | state.setBarWidth(Math.min(used / (rows * columns), maxWidth));↵ | |
28 | }↵ | 28 | }↵ | |
29 | else {↵ | 29 | else {↵ | |
30 | state.setBarWidth(Math.min(used, maxWidth));↵ | 30 | state.setBarWidth(Math.min(used, maxWidth));↵ | |
31 | }↵ | 31 | }↵ | |
32 | } | 32 |
| |
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) | 2.0 |
Clones location | Clones are in different classes having the same super class |
Number of node comparisons | 146 |
Number of mapped statements | 22 |
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) | 53.5 |
Clone type | Type 2 |
ID | Statement | ID | Statement | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | CategoryAxis domainAxis = getDomainAxis(plot, rendererIndex); | 1 | CategoryAxis domainAxis = getDomainAxis(plot, rendererIndex); | |||||||||||
2 | CategoryDataset dataset = plot.getDataset(rendererIndex); | 2 | CategoryDataset dataset = plot.getDataset(rendererIndex); | |||||||||||
3 | if (dataset != null) | 3 | if (dataset != null) | |||||||||||
4 | int columns = dataset.getColumnCount(); | 4 | int columns = dataset.getColumnCount(); | |||||||||||
5 | int rows = dataset.getRowCount(); | 5 | int rows = dataset.getRowCount(); | |||||||||||
6 | double space = 0.0; | 6 | double space = 0.0; | |||||||||||
7 | PlotOrientation orientation = plot.getOrientation(); | 7 | PlotOrientation orientation = plot.getOrientation(); | |||||||||||
8 | if (orientation == PlotOrientation.HORIZONTAL) | 8 | if (orientation == PlotOrientation.HORIZONTAL) | |||||||||||
9 | space = dataArea.getHeight(); | 9 | space = dataArea.getHeight(); | |||||||||||
10 | else if (orientation == PlotOrientation.VERTICAL) | 10 | else if (orientation == PlotOrientation.VERTICAL) | |||||||||||
11 | space = dataArea.getWidth(); | 11 | space = dataArea.getWidth(); | |||||||||||
12 | double maxWidth = space * getMaximumBarWidth(); |
| 12 | double maxWidth = space * getMaximumItemWidth(); | ||||||||||
13 | double categoryMargin = 0.0; |
| 14 | double currentItemMargin = 0.0; | ||||||||||
14 | double currentItemMargin = 0.0; |
| 13 | double categoryMargin = 0.0; | ||||||||||
15 | if (columns > 1) | 15 | if (columns > 1) | |||||||||||
16 | categoryMargin = domainAxis.getCategoryMargin(); | 16 | categoryMargin = domainAxis.getCategoryMargin(); | |||||||||||
17 | if (rows > 1) | 17 | if (rows > 1) | |||||||||||
18 | currentItemMargin = getItemMargin(); | 18 | currentItemMargin = getItemMargin(); | |||||||||||
19 | double used = space * (1 - domainAxis.getLowerMargin() - domainAxis.getUpperMargin() - categoryMargin - currentItemMargin); | 19 | double used = space * (1 - domainAxis.getLowerMargin() - domainAxis.getUpperMargin() - categoryMargin - currentItemMargin); | |||||||||||
20 | if ((rows * columns) > 0) | 20 | if ((rows * columns) > 0) | |||||||||||
21 | state.setBarWidth(Math.min(used / (rows * columns), maxWidth)); | 21 | state.setBarWidth(Math.min(used / (rows * columns), maxWidth)); | |||||||||||
else | else | |||||||||||||
22 | state.setBarWidth(Math.min(used, maxWidth)); | 22 | state.setBarWidth(Math.min(used, maxWidth)); |
Row | Violation |
---|