115-2-3

DefaultKeyedValues2D kv2D1 = new DefaultKeyedValues2D(); kv2D1.addValue(new Double(234.2), "Row1", "Col1"); kv2D1.addValue(null, "Row1", "Col2"); kv2D1.addValue(new Double(345.9), "Row2", "Col1"); kv2D1.addValue(new Double(452.7), "Row2", "Col2"); DefaultKeyedValues2D kv2D2 = null; try { ByteArrayOutputStream buffer = new ByteArrayOutputStream(); ObjectOutput out = new ObjectOutputStream(buffer); out.writeObject(kv2D1); out.close(); ObjectInput in = new ObjectInputStream( new ByteArrayInputStream(buffer.toByteArray())); kv2D2 = (DefaultKeyedValues2D) in.readObject(); in.close(); } catch (Exception e) { e.printStackTrace(); } assertEquals(kv2D1, kv2D2);
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);

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

1

    DefaultKeyedValues2D kv2D1 = new DefaultKeyedValues2D();↵

1

    DefaultKeyedValues2DDataset d1 = new DefaultKeyedValues2DDataset();↵

2

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

2

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

3

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

3

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

4

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

4

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

5

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

5

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

6

            DefaultKeyedValues2D kv2D2 = null;↵

6

            DefaultKeyedValues2DDataset d2 = null;↵

7

            try {↵

7

            try {↵

8

                ByteArrayOutputStream buffer = new ByteArrayOutputStream();↵

8

                ByteArrayOutputStream buffer = new ByteArrayOutputStream();↵

9

                ObjectOutput out = new ObjectOutputStream(buffer);↵

9

                ObjectOutput out = new ObjectOutputStream(buffer);↵

10

                out.writeObject(kv2D1);↵

10

                out.writeObject(d1);↵

11

                out.close();↵

11

                out.close();↵

12

                ObjectInput in = new ObjectInputStream(↵

12

                ObjectInput in = new ObjectInputStream(↵

13

                        new ByteArrayInputStream(buffer.toByteArray())↵

13

                    new ByteArrayInputStream(buffer.toByteArray())↵

14

    );↵

14

                );↵

15

                kv2D2 = (DefaultKeyedValues2D) in.readObject();↵

15

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

16

                in.close();↵

16

                in.close();↵

17

            }↵

17

            }↵

18

            catch (Exception e) {↵

18

            catch (Exception e) {↵

19

                e.printStackTrace();↵

19

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

20

            }↵

20

            }↵

21

            assertEquals(kv2D1, kv2D2);

21

            assertEquals(d1, d2);

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