42-5-7

public final class DialShape implements Serializable { /** For serialization. */ private static final long serialVersionUID = -3471933055190251131L; /** Circle. */ public static final DialShape CIRCLE = new DialShape("DialShape.CIRCLE"); /** Chord. */ public static final DialShape CHORD = new DialShape("DialShape.CHORD"); /** Pie. */ public static final DialShape PIE = new DialShape("DialShape.PIE"); /** The name. */ private String name; /** * Private constructor. * * @param name the name. */ private DialShape(String name) { this.name = name; } /** * Returns a string representing the object. * * @return The string. */ public String toString() { return this.name; } /** * Returns <code>true</code> if this object is equal to the specified * object, and <code>false</code> otherwise. * * @param obj the other object. * * @return A boolean. */ public boolean equals(Object obj) { if (this == obj) { return true; } if (!(obj instanceof DialShape)) { return false; } DialShape shape = (DialShape) obj; if (!this.name.equals(shape.toString())) { return false; } return true; } /** * Returns a hash code for this instance. * * @return A hash code. */ public int hashCode() { return this.name.hashCode(); } /** * Ensures that serialization returns the unique instances. * * @return The object. * * @throws ObjectStreamException if there is a problem. */ private Object readResolve() throws ObjectStreamException { if (this.equals(DialShape.CIRCLE)) { return DialShape.CIRCLE; } else if (this.equals(DialShape.CHORD)) { return DialShape.CHORD; } else if (this.equals(DialShape.PIE)) { return DialShape.PIE; } return null;
public final class RangeType implements Serializable { /** For serialization. */ private static final long serialVersionUID = -9073319010650549239L; /** Full range (positive and negative). */ public static final RangeType FULL = new RangeType("RangeType.FULL"); /** Positive range. */ public static final RangeType POSITIVE = new RangeType("RangeType.POSITIVE"); /** Negative range. */ public static final RangeType NEGATIVE = new RangeType("RangeType.NEGATIVE"); /** The name. */ private String name; /** * Private constructor. * * @param name the name. */ private RangeType(String name) { this.name = name; } /** * Returns a string representing the object. * * @return The string. */ public String toString() { return this.name; } /** * Returns <code>true</code> if this object is equal to the specified * object, and <code>false</code> otherwise. * * @param obj the other object. * * @return A boolean. */ public boolean equals(Object obj) { if (this == obj) { return true; } if (!(obj instanceof RangeType)) { return false; } RangeType that = (RangeType) obj; if (!this.name.equals(that.toString())) { return false; } return true; } /** * Returns a hash code value for the object. * * @return The hashcode */ public int hashCode() { return this.name.hashCode(); } /** * Ensures that serialization returns the unique instances. * * @return The object. * * @throws ObjectStreamException if there is a problem. */ private Object readResolve() throws ObjectStreamException { if (this.equals(RangeType.FULL)) { return RangeType.FULL; } else if (this.equals(RangeType.POSITIVE)) { return RangeType.POSITIVE; } else if (this.equals(RangeType.NEGATIVE)) { return RangeType.NEGATIVE; } return null;

Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/chart/plot/DialShape.java |  | File path: /jfreechart-1.0.10/src/org/jfree/data/RangeType.java
Method name: `` |  | Method name: ``
Number of AST nodes: 0 |  | Number of AST nodes: 0

1

    public final class DialShape implements Serializable {↵

1

    public final class RangeType implements Serializable {↵

2

        /** For serialization. */↵

2

        /** For serialization. */↵

3

        private static final long serialVersionUID = -3471933055190251131L;↵

3

        private static final long serialVersionUID = -9073319010650549239L;↵

4

        ↵

4

         ↵

5

        /** Circle. */↵

5

        /** Full range (positive and negative). */↵

6

        public static final DialShape CIRCLE = new DialShape("DialShape.CIRCLE");↵

6

        public static final RangeType FULL = new RangeType("RangeType.FULL");↵

7

        /** Chord. */↵

7

        /** Positive range. */↵

8

        public static final DialShape CHORD = new DialShape("DialShape.CHORD↵

8

        public static final RangeType POSITIVE ↵

9

    ");↵

9

            = new RangeType("RangeType.POSITIVE");↵

10

        /** Pie. */↵

10

        /** Negative range. */↵

11

        public static final DialShape PIE = new DialShape("DialShape.PI↵

11

        public static final RangeType NEGATIVE ↵

12

    E");↵

12

            = new RangeType("RangeType.NEGATIVE");↵

13

        /** The name. */↵

13

        /** The name. */↵

14

        private String name;↵

14

        private String name;↵

15

        /**↵

15

        /**↵

16

         * Private constructor.↵

16

         * Private constructor.↵

17

         *↵

17

         *↵

18

         * @param name  the name.↵

18

         * @param name  the name.↵

19

         */↵

19

         */↵

20

        private DialShape(String name) {↵

20

        private RangeType(String name) {↵

21

            this.name = name;↵

21

            this.name = name;↵

22

        }↵

22

        }↵

23

        /**↵

23

        /**↵

24

         * Returns a string representing the object.↵

24

         * Returns a string representing the object.↵

25

         *↵

25

         *↵

26

         * @return The string.↵

26

         * @return The string.↵

27

         */↵

27

         */↵

28

        public String toString() {↵

28

        public String toString() {↵

29

            return this.name;↵

29

            return this.name;↵

30

        }↵

30

        }↵

31

        /**↵

31

        /**↵

32

         * Returns <code>true</code> if this object is equal to the specified ↵

32

         * Returns <code>true</code> if this object is equal to the specified ↵

33

         * object, and <code>false</code> otherwise.↵

33

         * object, and <code>false</code> otherwise.↵

34

         *↵

34

         *↵

35

         * @param obj  the other object.↵

35

         * @param obj  the other object.↵

36

         *↵

36

         *↵

37

         * @return A boolean.↵

37

         * @return A boolean.↵

38

         */↵

38

         */↵

39

        public boolean equals(Object obj) {↵

39

        public boolean equals(Object obj) {↵

40

            if (this == obj) {↵

40

            if (this == obj) {↵

41

                return true;↵

41

                return true;↵

42

            }↵

42

            }↵

43

            if (!(obj instanceof DialShape)) {↵

43

            if (!(obj instanceof RangeType)) {↵

44

                return false;↵

44

                return false;↵

45

            }↵

45

            }↵

46

            DialShape shape = (DialShape) obj;↵

46

            RangeType that = (RangeType) obj;↵

47

            if (!this.name.equals(shape.toString())) {↵

47

            if (!this.name.equals(that.toString())) {↵

48

                return false;↵

48

                return false;↵

49

            }↵

49

            }↵

50

            return true;↵

50

            return true;↵

51

        }↵

51

        }↵

52

        ↵

52

        ↵

53

        /**↵

53

        /**↵

54

         * Returns a hash code for this instance.↵

54

         * Returns a hash code value for the object.↵

55

         * ↵

55

         *↵

56

         * @return A hash code.↵

56

         * @return The hashcode↵

57

         */↵

57

         */↵

58

        public int hashCode() {↵

58

        public int hashCode() {↵

59

            return this.name.hashCode();↵

59

            return this.name.hashCode();↵

60

        }↵

60

        }↵

61

        ↵

62

        /**↵

61

        /**↵

63

         * Ensures that serialization returns the unique instances.↵

62

         * Ensures that serialization returns the unique instances.↵

64

         * ↵

63

         * ↵

65

         * @return The object.↵

64

         * @return The object.↵

66

         * ↵

65

         * ↵

67

         * @throws ObjectStreamException if there is a problem.↵

66

         * @throws ObjectStreamException if there is a problem.↵

68

         */↵

67

         */↵

69

        private Object readResolve() throws ObjectStreamException {↵

68

        private Object readResolve() throws ObjectStreamException {↵

70

            if (this.equals(DialShape.CIRCLE)) {↵

69

            if (this.equals(RangeType.FULL)) {↵

71

                return DialShape.CIRCLE;↵

70

                return RangeType.FULL;↵

72

            }↵

71

            }↵

73

            else if (this.equals(DialShape.CHORD)) {↵

72

            else if (this.equals(RangeType.POSITIVE)) {↵

74

                return DialShape.CHORD;↵

73

                return RangeType.POSITIVE;↵

75

            }      ↵

74

            }↵

76

            else if (this.equals(DialShape.PIE)) {↵

75

            else if (this.equals(RangeType.NEGATIVE)) {↵

77

                return DialShape.PIE;↵

76

                return RangeType.NEGATIVE;↵

78

            }      ↵

77

            }↵

79

            return null;↵

78

            return null;↵

80

79

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.0
Clones location |
Number of node comparisons | 0