File path: /jfreechart-1.0.10/tests/org/jfree/chart/axis/junit/LogAxisTests.java | File path: /jfreechart-1.0.10/tests/org/jfree/chart/axis/junit/NumberAxisTests.java | |||
Method name: void testXYAutoRange2()
|
Method name: void testXYAutoRange1()
|
|||
Number of AST nodes: 12 | Number of AST nodes: 12 | |||
1 | XYSeries series = new XYSeries("Series 1");↵ | 1 | XYSeries series = new XYSeries("Series 1");↵ | |
2 | series.add(1.0, 1.0);↵ | 2 | series.add(1.0, 1.0);↵ | |
3 | series.add(2.0, 2.0);↵ | 3 | series.add(2.0, 2.0);↵ | |
4 | series.add(3.0, 3.0);↵ | 4 | series.add(3.0, 3.0);↵ | |
5 | XYSeriesCollection dataset = new XYSeriesCollection();↵ | 5 | XYSeriesCollection dataset = new XYSeriesCollection();↵ | |
6 | dataset.addSeries(series);↵ | 6 | dataset.addSeries(series);↵ | |
7 | JFreeChart chart = ChartFactory.createScatterPlot(↵ | 7 | JFreeChart chart = ChartFactory.createScatterPlot(↵ | |
8 | "Test",↵ | 8 | "Test", ↵ | |
9 | "X",↵ | 9 | "X",↵ | |
10 | "Y",↵ | 10 | "Y",↵ | |
11 | dataset,↵ | 11 | dataset,↵ | |
12 | PlotOrientation.VERTICAL,↵ | 12 | PlotOrientation.VERTICAL,↵ | |
13 | false,↵ | 13 | false, ↵ | |
14 | false,↵ | 14 | false,↵ | |
15 | false↵ | 15 | false↵ | |
16 | );↵ | 16 | );↵ | |
17 | XYPlot plot = (XYPlot) chart.getPlot();↵ | 17 | XYPlot plot = (XYPlot) chart.getPlot();↵ | |
18 | LogAxis axis = new LogAxis("Log(Y)");↵ | 18 | NumberAxis axis = ↵ | |
19 | plot.setRangeAxis(axis↵ | 19 | (NumberAxis) plot.getDomainAxis();↵ | |
20 | );↵ | 20 | axis.setAutoRangeIncludesZero(false);↵ | |
21 | assertEquals(0.9465508226401592, axis.getLowerBound(), EPSILON);↵ | 21 | assertEquals(0.9, axis.getLowerBound(), EPSILON); ↵ | |
22 | assertEquals(3.1694019256486126, axis.getUpperBound(), EPSILON); | 22 | assertEquals(3.1, axis.getUpperBound(), EPSILON); | |
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) | 0.0 |
Clones location | Clones are in different classes having the same super class |
Number of node comparisons | 72 |
Number of mapped statements | 11 |
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) | 0.0 |
Clone type | Type 2 |
ID | Statement | ID | Statement | ||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | XYSeries series = new XYSeries("Series 1"); | 1 | XYSeries series = new XYSeries("Series 1"); | ||||||||||||||||||||||
2 | series.add(1.0, 1.0); | 2 | series.add(1.0, 1.0); | ||||||||||||||||||||||
3 | series.add(2.0, 2.0); | 3 | series.add(2.0, 2.0); | ||||||||||||||||||||||
4 | series.add(3.0, 3.0); | 4 | series.add(3.0, 3.0); | ||||||||||||||||||||||
5 | XYSeriesCollection dataset = new XYSeriesCollection(); | 5 | XYSeriesCollection dataset = new XYSeriesCollection(); | ||||||||||||||||||||||
6 | dataset.addSeries(series); | 6 | dataset.addSeries(series); | ||||||||||||||||||||||
7 | JFreeChart chart = ChartFactory.createScatterPlot("Test", "X", "Y", dataset, PlotOrientation.VERTICAL, false, false, false); | 7 | JFreeChart chart = ChartFactory.createScatterPlot("Test", "X", "Y", dataset, PlotOrientation.VERTICAL, false, false, false); | ||||||||||||||||||||||
8 | XYPlot plot = (XYPlot)chart.getPlot(); | 8 | XYPlot plot = (XYPlot)chart.getPlot(); | ||||||||||||||||||||||
9 | LogAxis axis = new LogAxis("Log(Y)"); |
| 9 | NumberAxis axis = (NumberAxis)plot.getDomainAxis(); | |||||||||||||||||||||
|
| 10 | axis.setAutoRangeIncludesZero(false); | ||||||||||||||||||||||
10 | plot.setRangeAxis(axis); |
| | ||||||||||||||||||||||
11 | assertEquals(0.9465508226401592, axis.getLowerBound(), EPSILON); |
| 11 | assertEquals(0.9, axis.getLowerBound(), EPSILON); | |||||||||||||||||||||
12 | assertEquals(3.1694019256486126, axis.getUpperBound(), EPSILON); |
| 12 | assertEquals(3.1, axis.getUpperBound(), EPSILON); |
Row | Violation |
---|---|
1 | Expression new LogAxis("Log(Y)") cannot be parameterized, because it has dependencies to/from statements that will be extracted |
2 | Expression (NumberAxis)plot.getDomainAxis() cannot be parameterized, because it has dependencies to/from statements that will be extracted |
3 | Unmatched statement axis.setAutoRangeIncludesZero(false); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
4 | Unmatched statement plot.setRangeAxis(axis); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |