XYSeries series = new XYSeries("Series 1");
series.add(1.0, 1.0);
series.add(2.0, 2.0);
series.add(3.0, 3.0);
XYSeriesCollection dataset = new XYSeriesCollection();
dataset.addSeries(series);
JFreeChart chart = ChartFactory.createScatterPlot(
"Test",
"X",
"Y",
dataset,
PlotOrientation.VERTICAL,
false,
false,
false
);
XYPlot plot = (XYPlot) chart.getPlot();
LogAxis axis = new LogAxis("Log(Y)");
plot.setRangeAxis(axis);
assertEquals(0.9465508226401592, axis.getLowerBound(), EPSILON);
assertEquals(3.1694019256486126, axis.getUpperBound(), EPSILON);
XYSeries series = new XYSeries("Series 1");
series.add(1.0, 1.0);
series.add(2.0, 2.0);
series.add(3.0, 3.0);
XYSeriesCollection dataset = new XYSeriesCollection();
dataset.addSeries(series);
JFreeChart chart = ChartFactory.createScatterPlot(
"Test",
"X",
"Y",
dataset,
PlotOrientation.VERTICAL,
false,
false,
false
);
XYPlot plot = (XYPlot) chart.getPlot();
LogAxis axis = new LogAxis("Log(Y)");
plot.setRangeAxis(axis);
assertEquals(0.9465508226401592, axis.getLowerBound(), EPSILON);
assertEquals(3.1694019256486126, axis.getUpperBound(), EPSILON);
Clone fragments detected by clone detection tool
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/LogAxisTests.java
|
Method name: void testXYAutoRange1()
|
|
Method name: void testXYAutoRange2()
|
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 | LogAxis axis = new LogAxis("Log(Y)");↵
|
19 | plot.setRangeAxis(axis);↵ | | 19 | plot.setRangeAxis(axis);↵
|
20 | assertEquals(0.9465508226401592, axis.getLowerBound(), EPSILON);↵ | | 20 | assertEquals(0.9465508226401592, axis.getLowerBound(), EPSILON);↵
|
21 | assertEquals(3.1694019256486126, axis.getUpperBound(), EPSILON); | | 21 | assertEquals(3.1694019256486126, axis.getUpperBound(), EPSILON);
|
See real code fragment |
|
See real code fragment |
Summary
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 declared in the same class |
Number of node comparisons | 58 |
-
{Refactorable}
Mapping Summary
Number of mapped statements | 12 |
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) | 0.0 |
Clone type | Type 1 |
Mapped Statements
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 | LogAxis axis = new LogAxis("Log(Y)"); |
10 | plot.setRangeAxis(axis); | | 10 | plot.setRangeAxis(axis); |
11 | assertEquals(0.9465508226401592, axis.getLowerBound(), EPSILON); | | 11 | assertEquals(0.9465508226401592, axis.getLowerBound(), EPSILON); |
12 | assertEquals(3.1694019256486126, axis.getUpperBound(), EPSILON); | | 12 | assertEquals(3.1694019256486126, axis.getUpperBound(), EPSILON); |
Precondition Violations (0)
Row |
Violation |