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