142-6-43

YIntervalSeries s1 = new YIntervalSeries("s1"); s1.add(1.0, 0.5, 1.5, 2.0); YIntervalSeries s2 = null; try { ByteArrayOutputStream buffer = new ByteArrayOutputStream(); ObjectOutput out = new ObjectOutputStream(buffer); out.writeObject(s1); out.close(); ObjectInput in = new ObjectInputStream( new ByteArrayInputStream(buffer.toByteArray())); s2 = (YIntervalSeries) in.readObject(); in.close(); } catch (Exception e) { e.printStackTrace(); } assertEquals(s1, s2);
CategoryLabelPositions p1 = CategoryLabelPositions.STANDARD; CategoryLabelPositions p2 = null; try { ByteArrayOutputStream buffer = new ByteArrayOutputStream(); ObjectOutput out = new ObjectOutputStream(buffer); out.writeObject(p1); out.close(); ObjectInput in = new ObjectInputStream( new ByteArrayInputStream(buffer.toByteArray()) ); p2 = (CategoryLabelPositions) in.readObject(); in.close(); } catch (Exception e) { System.out.println(e.toString()); } assertEquals(p1, p2);

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

1

    YIntervalSeries s1 = new YIntervalSeries("s1");↵

1

    CategoryLabelPositions p1 = ↵

2

            s1.add(1.0, 0.5, 1.5, 2.0);↵

3

            YIntervalSerie↵

2

    CategoryLabelPositions.STANDARD;↵

4

    s s2 = null;↵

3

            CategoryLabelPositions p2 = null;↵

5

            ↵

6

            try {↵

4

            try {↵

7

                ByteArrayOutputStream buffer = new ByteArrayOutputStream();↵

5

                ByteArrayOutputStream buffer = new ByteArrayOutputStream();↵

8

                ObjectOutput out = new ObjectOutputStream(buffer);↵

6

                ObjectOutput out = new ObjectOutputStream(buffer);↵

9

                out.writeObject(s1);↵

7

                out.writeObject(p1);↵

10

                out.close();↵

8

                out.close();↵

11

                ObjectInput in = new ObjectInputStream(↵

9

                ObjectInput in = new ObjectInputStream(↵

12

                        new ByteArrayInputStream(buffer.toByteArray())↵

10

                    new ByteArrayInputStream(buffer.toByteArray())↵

13

    );↵

11

                );↵

14

                s2 = (YIntervalSeries) in.readObject();↵

12

                p2 = (CategoryLabelPositions) in.readObject();↵

15

                in.close();↵

13

                in.close();↵

16

            }↵

14

            }↵

17

            catch (Exception e) {↵

15

            catch (Exception e) {↵

18

                e.printStackTrace();↵

16

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

19

            }↵

17

            }↵

20

            assertEquals(s1, s2);

18

            assertEquals(p1, p2);

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