File path: /jfreechart-1.0.10/src/org/jfree/chart/renderer/category/BoxAndWhiskerRenderer.java | File path: /jfreechart-1.0.10/src/org/jfree/chart/renderer/category/LevelRenderer.java | |||
Method name: CategoryItemRendererState initialise(Graphics2D, Rectangle2D, CategoryPlot, int, PlotRenderingInfo)
|
Method name: void calculateItemWidth(CategoryPlot, Rectangle2D, int, CategoryItemRendererState)
|
|||
Number of AST nodes: 20 | Number of AST nodes: 20 | |||
1 | if (dataset != null) {↵ | 1 | if (dataset != null) {↵ | |
2 | int columns = dataset.getColumnCount();↵ | 2 | int columns = dataset.getColumnCount();↵ | |
3 | int rows = dataset.getRowCount();↵ | 3 | int rows = dataset.getRowCount();↵ | |
4 | double space = 0.0;↵ | 4 | double space = 0.0;↵ | |
5 | PlotOrientation orientation = plot.getOrientation();↵ | 5 | PlotOrientation orientation = plot.getOrientation();↵ | |
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 * getMaximumItemWidth();↵ | |
13 | double categoryMargin = 0.0;↵ | 13 | double categoryMargin = 0.0;↵ | |
14 | double currentItemMargin = 0.0;↵ | 14 | double currentItemMargin = 0.0;↵ | |
15 | if (columns > 1) {↵ | 15 | if (columns > 1) {↵ | |
16 | categoryMargin = domainAxis.getCategoryMargin();↵ | 16 | categoryMargin = domainAxis.getCategoryMargin();↵ | |
17 | }↵ | 17 | }↵ | |
18 | if (rows > 1) {↵ | 18 | if (rows > 1) {↵ | |
19 | currentItemMargin = getItemMargin();↵ | 19 | currentItemMargin = getItemMargin();↵ | |
20 | }↵ | 20 | }↵ | |
21 | double used = space * (1 - domainAxis.getLowerMargin()↵ | 21 | double used = space * (1 - domainAxis.getLowerMargin()↵ | |
22 | - domainAxis.getUpperMargin()↵ | 22 | - domainAxis.getUpperMargin()↵ | |
23 | - categoryMargin - currentItemMargin);↵ | 23 | - categoryMargin - currentItemMargin);↵ | |
24 | if ((rows * columns) > 0) {↵ | 24 | if ((rows * columns) > 0) {↵ | |
25 | state.setBarWidth(Math.min(used / (dataset.getColumnCount()↵ | 25 | state.setBarWidth(Math.min(used / (↵ | |
26 | * dataset.getRowCount()), maxWidth));↵ | 26 | rows * columns), maxWidth));↵ | |
27 | }↵ | 27 | }↵ | |
28 | else {↵ | 28 | else {↵ | |
29 | state.setBarWidth(Math.min(used, maxWidth));↵ | 29 | state.setBarWidth(Math.min(used, maxWidth));↵ | |
30 | }↵ | 30 | }↵ | |
31 | } | 31 |
| |
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.6 |
Clones location | Clones are in different classes having the same super class |
Number of node comparisons | 164 |
Number of mapped statements | 20 |
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) | 6.8 |
Clone type | Type 2 |
ID | Statement | ID | Statement | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
4 | if (dataset != null) | 3 | if (dataset != null) | ||||||||||||||||||
5 | int columns = dataset.getColumnCount(); | 4 | int columns = dataset.getColumnCount(); | ||||||||||||||||||
6 | int rows = dataset.getRowCount(); | 5 | int rows = dataset.getRowCount(); | ||||||||||||||||||
7 | double space = 0.0; | 6 | double space = 0.0; | ||||||||||||||||||
8 | PlotOrientation orientation = plot.getOrientation(); | 7 | PlotOrientation orientation = plot.getOrientation(); | ||||||||||||||||||
9 | if (orientation == PlotOrientation.HORIZONTAL) | 8 | if (orientation == PlotOrientation.HORIZONTAL) | ||||||||||||||||||
10 | space = dataArea.getHeight(); | 9 | space = dataArea.getHeight(); | ||||||||||||||||||
11 | else if (orientation == PlotOrientation.VERTICAL) | 10 | else if (orientation == PlotOrientation.VERTICAL) | ||||||||||||||||||
12 | space = dataArea.getWidth(); | 11 | space = dataArea.getWidth(); | ||||||||||||||||||
13 | double maxWidth = space * getMaximumBarWidth(); |
| 12 | double maxWidth = space * getMaximumItemWidth(); | |||||||||||||||||
14 | double categoryMargin = 0.0; |
| 14 | double currentItemMargin = 0.0; | |||||||||||||||||
15 | double currentItemMargin = 0.0; |
| 13 | double categoryMargin = 0.0; | |||||||||||||||||
16 | if (columns > 1) | 15 | if (columns > 1) | ||||||||||||||||||
17 | categoryMargin = domainAxis.getCategoryMargin(); | 16 | categoryMargin = domainAxis.getCategoryMargin(); | ||||||||||||||||||
18 | if (rows > 1) | 17 | if (rows > 1) | ||||||||||||||||||
19 | currentItemMargin = getItemMargin(); | 18 | currentItemMargin = getItemMargin(); | ||||||||||||||||||
20 | double used = space * (1 - domainAxis.getLowerMargin() - domainAxis.getUpperMargin() - categoryMargin - currentItemMargin); | 19 | double used = space * (1 - domainAxis.getLowerMargin() - domainAxis.getUpperMargin() - categoryMargin - currentItemMargin); | ||||||||||||||||||
21 | if ((rows * columns) > 0) | 20 | if ((rows * columns) > 0) | ||||||||||||||||||
22 | state.setBarWidth(Math.min(used / (dataset.getColumnCount() * dataset.getRowCount()), 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 | Expression dataset.getColumnCount() cannot be parameterized, because it has dependencies to/from statements that will be extracted |
2 | Expression rows cannot be parameterized, because it has dependencies to/from statements that will be extracted |
3 | Expression dataset.getRowCount() cannot be parameterized, because it has dependencies to/from statements that will be extracted |
4 | Expression columns cannot be parameterized, because it has dependencies to/from statements that will be extracted |