42-4-8

public final class ChartChangeEventType implements Serializable { /** For serialization. */ private static final long serialVersionUID = 5481917022435735602L; /** GENERAL. */ public static final ChartChangeEventType GENERAL = new ChartChangeEventType("ChartChangeEventType.GENERAL"); /** NEW_DATASET. */ public static final ChartChangeEventType NEW_DATASET = new ChartChangeEventType("ChartChangeEventType.NEW_DATASET"); /** DATASET_UPDATED. */ public static final ChartChangeEventType DATASET_UPDATED = new ChartChangeEventType("ChartChangeEventType.DATASET_UPDATED"); /** The name. */ private String name; /** * Private constructor. * * @param name the name. */ private ChartChangeEventType(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 object (<code>null</code> permitted). * * @return A boolean. */ public boolean equals(Object obj) { if (this == obj) { return true; } if (!(obj instanceof ChartChangeEventType)) { return false; } ChartChangeEventType that = (ChartChangeEventType) 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(ChartChangeEventType.GENERAL)) { return ChartChangeEventType.GENERAL; } else if (this.equals(ChartChangeEventType.NEW_DATASET)) { return ChartChangeEventType.NEW_DATASET; } else if (this.equals(ChartChangeEventType.DATASET_UPDATED)) { return ChartChangeEventType.DATASET_UPDATED; } return null;
public final class TimePeriodAnchor implements Serializable { /** For serialization. */ private static final long serialVersionUID = 2011955697457548862L; /** Start of period. */ public static final TimePeriodAnchor START = new TimePeriodAnchor("TimePeriodAnchor.START"); /** Middle of period. */ public static final TimePeriodAnchor MIDDLE = new TimePeriodAnchor("TimePeriodAnchor.MIDDLE"); /** End of period. */ public static final TimePeriodAnchor END = new TimePeriodAnchor("TimePeriodAnchor.END"); /** The name. */ private String name; /** * Private constructor. * * @param name the name. */ private TimePeriodAnchor(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 TimePeriodAnchor)) { return false; } TimePeriodAnchor position = (TimePeriodAnchor) obj; if (!this.name.equals(position.name)) { 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(TimePeriodAnchor.START)) { return TimePeriodAnchor.START; } else if (this.equals(TimePeriodAnchor.MIDDLE)) { return TimePeriodAnchor.MIDDLE; } else if (this.equals(TimePeriodAnchor.END)) { return TimePeriodAnchor.END; } return null;

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

1

    public final class ChartChangeEventType implements Serializable {↵

1

    public final class TimePeriodAnchor implements Serializable {↵

2

        /** For serialization. */↵

2

        /** For serialization. */↵

3

        private static final long serialVersionUID = 5481917022435735602L;↵

3

        private static final long serialVersionUID = 2011955697457548862L;↵

4

        ↵

4

        ↵

5

        /** GENERAL. */↵

5

        /** Start of period. */↵

6

        public static final ChartChangeEventType GENERAL ↵

6

        public static final ↵

7

                = new ChartChangeEventType("ChartChangeEventType.GENERAL");↵

8

        /** NEW_DATASET. */↵

9

        public static final ChartChangeEventType NEW_DATASET ↵

10

                = new ChartChangeEventType("ChartChangeEventType.NEW_DATASET");↵

11

        /** DATASET_UPDATED. */↵

12

        public static final ChartChangeEventType DATASET_UPDATED↵

13

       ↵

7

    TimePeriodAnchor START ↵

8

            = new TimePeriodAnchor("TimePeriodAnchor.START");↵

9

        /** Middle of period. */↵

10

        public static final TimePeriodAnchor MIDDLE ↵

11

            = new TimePeriodAnchor("TimePeriodAnchor.MIDDLE");↵

12

        /** End of period. */↵

13

        public static final TimePeriodAnchor END ↵

14

             = new ChartChangeEventType("ChartChangeEventType.DATASET_UPDATED");↵

14

            = new TimePeriodAnchor("TimePeriodAnchor.END");↵

15

        /** The name. */↵

15

        /** The name. */↵

16

        private String name;↵

16

        private String name;↵

17

        /**↵

17

        /**↵

18

         * Private constructor.↵

18

         * Private constructor.↵

19

         *↵

19

         *↵

20

         * @param name  the name.↵

20

         * @param name  the name.↵

21

         */↵

21

         */↵

22

        private ChartChangeEventType(String name) {↵

22

        private TimePeriodAnchor(String name) {↵

23

            this.name = name;↵

23

            this.name = name;↵

24

        }↵

24

        }↵

25

        /**↵

25

        /**↵

26

         * Returns a string representing the object.↵

26

         * Returns a string representing the object.↵

27

         *↵

27

         *↵

28

         * @return The string.↵

28

         * @return The string.↵

29

         */↵

29

         */↵

30

        public String toString() {↵

30

        public String toString() {↵

31

            return this.name;↵

31

            return this.name;↵

32

        }↵

32

        }↵

33

        /**↵

33

        /**↵

34

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

34

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

35

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

35

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

36

         *↵

36

         *↵

37

         * @param obj  the object (<code>null</code> permitted).↵

37

         * @param obj  the other object.↵

38

         *↵

38

         *↵

39

         * @return A boolean.↵

39

         * @return A boolean.↵

40

         */↵

40

         */↵

41

        public boolean equals(Object obj) {↵

41

        public boolean equals(Object obj) {↵

42

            if (this == obj) {↵

42

            if (this == obj) {↵

43

                return true;↵

43

                return true;↵

44

            }↵

44

            }↵

45

            if (!(obj instanceof ChartChangeEventType)) {↵

45

            if (!(obj instanceof TimePeriodAnchor)) {↵

46

                return false;↵

46

                return false;↵

47

            }↵

47

            }↵

48

            ChartChangeEventType that = (ChartChangeEventType) obj;↵

48

            TimePeriodAnchor position = (TimePeriodAnchor) obj;↵

49

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

49

            if (!this.name.equals(position.name)) {↵

50

                return false;↵

50

                return false;↵

51

            }↵

51

            }↵

52

            return true;↵

52

            return true;↵

53

        }↵

53

        }↵

54

        ↵

55

        /**↵

54

        /**↵

56

         * Returns a hash code value for the object.↵

55

         * Returns a hash code value for the object.↵

57

         *↵

56

         *↵

58

         * @return The hashcode↵

57

         * @return The hashcode↵

59

         */↵

58

         */↵

60

        public int hashCode() {↵

59

        public int hashCode() {↵

61

            return this.name.hashCode();↵

60

            return this.name.hashCode();↵

62

        }↵

61

        }↵

62

        ↵

63

        /**↵

63

        /**↵

64

         * Ensures that serialization returns the unique instances.↵

64

         * Ensures that serialization returns the unique instances.↵

65

         * ↵

65

         * ↵

66

         * @return The object.↵

66

         * @return The object.↵

67

         * ↵

67

         * ↵

68

         * @throws ObjectStreamException if there is a problem.↵

68

         * @throws ObjectStreamException if there is a problem.↵

69

         */↵

69

         */↵

70

        private Object readResolve() throws ObjectStreamException {↵

70

        private Object readResolve() throws ObjectStreamException {↵

71

            if (this.equals(ChartChangeEventType.GENERAL)) {↵

71

            if (this.equals(↵

72

                return ChartChangeEventType.GENERAL↵

72

    TimePeriodAnchor.START)) {↵

73

    ;↵

73

                return TimePeriodAnchor.START;↵

74

            }↵

74

            }↵

75

            else if (this.equals(ChartChangeEventType.NEW_DATASET)) {↵

75

            else if (this.equals(↵

76

                return ChartChangeEventType.NEW_DATASET↵

76

    TimePeriodAnchor.MIDDLE)) {↵

77

    ;↵

77

                return TimePeriodAnchor.MIDDLE;↵

78

            }↵

78

            }↵

79

            else if (this.equals(ChartChangeEventType.DATASET_UPDATED)) {↵

79

            else if (this.equals(↵

80

                return ChartChangeEventType.DATASET_UPDATE↵

80

    TimePeriodAnchor.END)) {↵

81

    D;↵

81

                return TimePeriodAnchor.END;↵

82

            }↵

82

            }↵

83

            return null;↵

83

            return null;↵

84

84

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