115-3-14

DefaultKeyedValues2DDataset d1 = new DefaultKeyedValues2DDataset(); d1.addValue(new Double(234.2), "Row1", "Col1"); d1.addValue(null, "Row1", "Col2"); d1.addValue(new Double(345.9), "Row2", "Col1"); d1.addValue(new Double(452.7), "Row2", "Col2"); DefaultKeyedValues2DDataset 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 = (DefaultKeyedValues2DDataset) in.readObject(); in.close(); } catch (Exception e) { System.out.println(e.toString()); } assertEquals(d1, d2);
CategoryPointerAnnotation a1 = new CategoryPointerAnnotation("Label", "A", 20.0, Math.PI); CategoryPointerAnnotation a2 = null; try { ByteArrayOutputStream buffer = new ByteArrayOutputStream(); ObjectOutput out = new ObjectOutputStream(buffer); out.writeObject(a1); out.close(); ObjectInput in = new ObjectInputStream(new ByteArrayInputStream( buffer.toByteArray())); a2 = (CategoryPointerAnnotation) in.readObject(); in.close(); } catch (Exception e) { e.printStackTrace(); } assertEquals(a1, a2);

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

1

    DefaultKeyedValues2DDataset d1 = new DefaultKeyedValues2DDataset();↵

2

            d1.addValue(new Double(234.2), "Row1", "Col1");↵

3

            d1.addValue(null, "Row1", "Col2");↵

4

            d1.addValue(new Double(345.9), "Row2", "Col1");↵

5

            d1.addValue(new Double(452.7), "Row2", "Col2"↵

1

    CategoryPointerAnnotation a1 = new CategoryPointerAnnotation("Label",↵

6

    );↵

2

                    "A", 20.0, Math.PI);↵

7

            DefaultKeyedValues2DDataset d2 = null;↵

3

            CategoryPointerAnnotation a2 = null;↵

8

            try {↵

4

            try {↵

9

                ByteArrayOutputStream buffer = new ByteArrayOutputStream();↵

5

                ByteArrayOutputStream buffer = new ByteArrayOutputStream();↵

10

                ObjectOutput out = new ObjectOutputStream(buffer);↵

6

                ObjectOutput out = new ObjectOutputStream(buffer);↵

11

                out.writeObject(d1);↵

7

                out.writeObject(a1);↵

12

                out.close();↵

8

                out.close();↵

13

                ObjectInput in = new ObjectInputStream(↵

9

                ObjectInput in = new ObjectInputStream(↵

14

                    new ByteArrayInputStream(↵

10

    new ByteArrayInputStream(↵

15

    buffer.toByteArray())↵

11

                        buffer.toByteArray())↵

16

                );↵

12

    );↵

17

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

13

                a2 = (CategoryPointerAnnotation) in.readObject();↵

18

                in.close();↵

14

                in.close();↵

19

            }↵

15

            }↵

20

            catch (Exception e) {↵

16

            catch (Exception e) {↵

21

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

17

                e.printStackTrace();↵

22

            }↵

18

            }↵

23

            assertEquals(d1, d2);

19

            assertEquals(a1, a2);

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