File path: /jfreechart-1.0.10/tests/org/jfree/data/time/ohlc/junit/OHLCSeriesCollectionTests.java | File path: /jfreechart-1.0.10/tests/org/jfree/data/xy/junit/MatrixSeriesCollectionTests.java | |||
Method name: void testSerialization()
|
Method name: void testSerialization()
|
|||
Number of AST nodes: 14 | Number of AST nodes: 14 | |||
1 | OHLCSeriesCollection c1 = new OHLCSeriesCollection();↵ | |||
2 | OHLCSeries s1 = new OHLCSeries("Series");↵ | 1 | MatrixSeries s1 = new MatrixSeries("Series", 2, 3);↵ | |
3 | s1.add(new Year(2006), 1.0, 1.1, 1.2, 1.3↵ | 2 | s1.update(0, 0, 1.1);↵ | |
4 | );↵ | 3 | MatrixSeriesCollection c1 = new MatrixSeriesCollection();↵ | |
5 | c1.addSeries(s1);↵ | 4 | c1.addSeries(s1);↵ | |
6 | OHLCSeriesCollection c2 = null;↵ | 5 | MatrixSeriesCollection c2 = null;↵ | |
7 | ↵ | |||
8 | try {↵ | 6 | try {↵ | |
9 | ByteArrayOutputStream buffer = new ByteArrayOutputStream();↵ | 7 | ByteArrayOutputStream buffer = new ByteArrayOutputStream();↵ | |
10 | ObjectOutput out = new ObjectOutputStream(buffer);↵ | 8 | ObjectOutput out = new ObjectOutputStream(buffer);↵ | |
11 | out.writeObject(c1);↵ | 9 | out.writeObject(c1);↵ | |
12 | out.close();↵ | 10 | out.close();↵ | |
13 | ObjectInput in = new ObjectInputStream(↵ | 11 | ObjectInput in = new ObjectInputStream(↵ | |
14 | new ByteArrayInputStream(buffer.toByteArray()));↵ | 12 | new ByteArrayInputStream(buffer.toByteArray()));↵ | |
15 | c2 = (OHLCSeriesCollection) in.readObject();↵ | 13 | c2 = (MatrixSeriesCollection) in.readObject();↵ | |
16 | in.close();↵ | 14 | in.close();↵ | |
17 | }↵ | 15 | }↵ | |
18 | catch (Exception e) {↵ | 16 | catch (Exception e) {↵ | |
19 | e.printStackTrace();↵ | 17 | e.printStackTrace();↵ | |
20 | }↵ | 18 | }↵ | |
21 | assertEquals(c1, c2); | 19 |
| |
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) | 0.1 |
Clones location | Clones are in different classes having the same super class |
Number of node comparisons | 79 |
Number of mapped statements | 14 |
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) | 67.8 |
Clone type | Type 2 |
ID | Statement | ID | Statement | ||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | OHLCSeriesCollection c1 = new OHLCSeriesCollection(); |
| 3 | MatrixSeriesCollection c1 = new MatrixSeriesCollection(); | |||||||||||||||||||||||||
2 | OHLCSeries s1 = new OHLCSeries("Series"); |
| 1 | MatrixSeries s1 = new MatrixSeries("Series", 2, 3); | |||||||||||||||||||||||||
3 | s1.add(new Year(2006), 1.0, 1.1, 1.2, 1.3); |
| 2 | s1.update(0, 0, 1.1); | |||||||||||||||||||||||||
4 | c1.addSeries(s1); |
| 4 | c1.addSeries(s1); | |||||||||||||||||||||||||
5 | OHLCSeriesCollection c2 = null; |
| 5 | MatrixSeriesCollection c2 = null; | |||||||||||||||||||||||||
6 | try | 6 | try | ||||||||||||||||||||||||||
7 | ByteArrayOutputStream buffer = new ByteArrayOutputStream(); | 7 | ByteArrayOutputStream buffer = new ByteArrayOutputStream(); | ||||||||||||||||||||||||||
8 | ObjectOutput out = new ObjectOutputStream(buffer); | 8 | ObjectOutput out = new ObjectOutputStream(buffer); | ||||||||||||||||||||||||||
9 | out.writeObject(c1); |
| 9 | out.writeObject(c1); | |||||||||||||||||||||||||
10 | out.close(); | 10 | out.close(); | ||||||||||||||||||||||||||
11 | ObjectInput in = new ObjectInputStream(new ByteArrayInputStream(buffer.toByteArray())); | 11 | ObjectInput in = new ObjectInputStream(new ByteArrayInputStream(buffer.toByteArray())); | ||||||||||||||||||||||||||
12 | c2 = (OHLCSeriesCollection)in.readObject(); |
| 12 | c2 = (MatrixSeriesCollection)in.readObject(); | |||||||||||||||||||||||||
13 | in.close(); | 13 | in.close(); | ||||||||||||||||||||||||||
14 | assertEquals(c1, c2); |
| 14 | assertEquals(c1, c2); |
Row | Violation |
---|---|
1 | Expression new OHLCSeriesCollection() cannot be parameterized, because it has dependencies to/from statements that will be extracted |
2 | Expression new MatrixSeriesCollection() cannot be parameterized, because it has dependencies to/from statements that will be extracted |
3 | Expression new MatrixSeries("Series",2,3) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
4 | Expression new MatrixSeries("Series",2,3) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
5 | Expression s1.add(new Year(2006),1.0,1.1,1.2,1.3) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
6 | Expression s1.update(0,0,1.1) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
7 | Expression s1.add(new Year(2006),1.0,1.1,1.2,1.3) is a void method call, and thus it cannot be parameterized |
8 | Expression s1.update(0,0,1.1) is a void method call, and thus it cannot be parameterized |
9 | Expression s1 cannot be unified with expression s1 , because common superclass org.jfree.data.general.Series does not declare member(s) public void add(org.jfree.data.time.RegularTimePeriod, double, double, double, double) , public void update(int, int, double) |
10 | Expression s1.add(new Year(2006),1.0,1.1,1.2,1.3) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
11 | Expression s1.update(0,0,1.1) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
12 | Expression s1.add(new Year(2006),1.0,1.1,1.2,1.3) is a void method call, and thus it cannot be parameterized |
13 | Expression s1.update(0,0,1.1) is a void method call, and thus it cannot be parameterized |
14 | Expression s1 cannot be unified with expression s1 , because common superclass type org.jfree.data.general.Series cannot be passed as an argument to public void addSeries(org.jfree.data.time.ohlc.OHLCSeries) |
15 | Expression c1 cannot be unified with expression c1 , because common superclass org.jfree.data.xy.AbstractXYDataset does not declare member(s) public void addSeries(org.jfree.data.time.ohlc.OHLCSeries) , public void addSeries(org.jfree.data.xy.MatrixSeries) |
16 | Expression (OHLCSeriesCollection)in.readObject() cannot be parameterized, because it has dependencies to/from statements that will be extracted |
17 | Expression (MatrixSeriesCollection)in.readObject() cannot be parameterized, because it has dependencies to/from statements that will be extracted |