114-1-8

DefaultTableXYDataset d1 = new DefaultTableXYDataset(); XYSeries s1 = new XYSeries("Series 1", true, false); s1.add(1.0, 1.1); s1.add(2.0, 2.2); d1.addSeries(s1); DefaultTableXYDataset d2 = null; try { ByteArrayOutputStream buffer = new ByteArrayOutputStream(); ObjectOutput out = new ObjectOutputStream(buffer); out.writeObject(d1); out.close(); ObjectInput in = new ObjectInputStream( new ByteArrayInputStream(buffer.toByteArray())); d2 = (DefaultTableXYDataset) in.readObject(); in.close(); } catch (Exception e) { e.printStackTrace(); } assertEquals(d1, d2);
FlowArrangement f1 = new FlowArrangement( HorizontalAlignment.LEFT, VerticalAlignment.TOP, 1.0, 2.0 ); FlowArrangement f2 = null; try { ByteArrayOutputStream buffer = new ByteArrayOutputStream(); ObjectOutput out = new ObjectOutputStream(buffer); out.writeObject(f1); out.close(); ObjectInput in = new ObjectInputStream( new ByteArrayInputStream(buffer.toByteArray()) ); f2 = (FlowArrangement) in.readObject(); in.close(); } catch (Exception e) { System.out.println(e.toString()); } assertEquals(f1, f2);

Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/tests/org/jfree/data/xy/junit/DefaultTableXYDatasetTests.java |  | File path: /jfreechart-1.0.10/tests/org/jfree/chart/block/junit/FlowArrangementTests.java
Method name: `void testSerialization()` |  | Method name: `void testSerialization()`
Number of AST nodes: 15 |  | Number of AST nodes: 11

1

    DefaultTableXYDataset d1 = new DefaultTableXYDataset();↵

1

    FlowArrangement f1 = new ↵

2

            XYSeries s1 = new XYSeries("Series 1", true, false);↵

3

            s1.add(1.0, 1.1);↵

4

            s1.add(2↵

2

    FlowArrangement(↵

5

    .0, 2.2);↵

3

                HorizontalAlignment.LEFT, VerticalAlignment.TOP, 1.0, 2.0↵

6

            d1.addSeries(s1);↵

4

            );↵

7

            DefaultTableXYDataset d2 = null;↵

5

            FlowArrangement f2 = null;↵

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(d1);↵

9

                out.writeObject(f1);↵

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

    );↵

13

                );↵

16

                d2 = (DefaultTableXYDataset) in.readObject();↵

14

                f2 = (FlowArrangement) in.readObject();↵

17

                in.close();↵

15

                in.close();↵

18

            }↵

16

            }↵

19

            catch (Exception e) {↵

17

            catch (Exception e) {↵

20

                e.printStackTrace();↵

18

                System.out.println(e.toString());↵

21

            }↵

19

            }↵

22

            assertEquals(d1, d2);

20

            assertEquals(f1, f2);

See real code fragment |  | See real code fragment

Summary
Number of common nesting structure subtrees | 0
Number of refactorable cases | 0
Number of non-refactorable cases | 0
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 | 1