42-7-8

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;
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/data/RangeType.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 RangeType implements Serializable {↵

1

    public final class TimePeriodAnchor implements Serializable {↵

2

        /** For serialization. */↵

2

        /** For serialization. */↵

3

        private static final long serialVersionUID = -9073319010650549239L;↵

3

        private static final long serialVersionUID = 2011955697457548862L;↵

4

         ↵

4

        ↵

5

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

5

        /** ↵

6

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

7

        /** Positive range↵

6

    Start of period. */↵

7

        public static final TimePeriodAnchor START ↵

8

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

8

    . */↵

9

        /** Middle of period. */↵

9

        public static final RangeType POSITIVE ↵

10

        public static final ↵

10

            = new RangeType("RangeType.POSITIV↵

11

    TimePeriodAnchor MIDDLE ↵

11

    E");↵

12

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

12

        /** Negative range. */↵

13

        /** End of period. */↵

13

        public static final RangeType NEGATIVE ↵

14

        public static final ↵

14

            = new RangeType("RangeType.NEGATIVE↵

15

    TimePeriodAnchor END ↵

15

    ");↵

16

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

16

        /** The name. */↵

17

        /** The name. */↵

17

        private String name;↵

18

        private String name;↵

18

        /**↵

19

        /**↵

19

         * Private constructor.↵

20

         * Private constructor.↵

20

         *↵

21

         *↵

21

         * @param name  the name.↵

22

         * @param name  the name.↵

22

         */↵

23

         */↵

23

        private RangeType(String name) {↵

24

        private TimePeriodAnchor(String name) {↵

24

            this.name = name;↵

25

            this.name = name;↵

25

        }↵

26

        }↵

26

        /**↵

27

        /**↵

27

         * Returns a string representing the object.↵

28

         * Returns a string representing the object.↵

28

         *↵

29

         *↵

29

         * @return The string.↵

30

         * @return The string.↵

30

         */↵

31

         */↵

31

        public String toString() {↵

32

        public String toString() {↵

32

            return this.name;↵

33

            return this.name;↵

33

        }↵

34

        }↵

34

        /**↵

35

        /**↵

35

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

36

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

36

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

37

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

37

         *↵

38

         *↵

38

         * @param obj  the other object.↵

39

         * @param obj  the other object.↵

39

         *↵

40

         *↵

40

         * @return A boolean.↵

41

         * @return A boolean.↵

41

         */↵

42

         */↵

42

        public boolean equals(Object obj) {↵

43

        public boolean equals(Object obj) {↵

43

            if (this == obj) {↵

44

            if (this == obj) {↵

44

                return true;↵

45

                return true;↵

45

            }↵

46

            }↵

46

            if (!(obj instanceof RangeType)) {↵

47

            if (!(obj instanceof TimePeriodAnchor)) {↵

47

                return false;↵

48

                return false;↵

48

            }↵

49

            }↵

49

            RangeType that = (RangeType) obj;↵

50

            TimePeriodAnchor position = (TimePeriodAnchor) obj;↵

50

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

51

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

51

                return false;↵

52

                return false;↵

52

            }↵

53

            }↵

53

            return true;↵

54

            return true;↵

54

        }↵

55

        }↵

55

        ↵

56

        /**↵

56

        /**↵

57

         * Returns a hash code value for the object.↵

57

         * Returns a hash code value for the object.↵

58

         *↵

58

         *↵

59

         * @return The hashcode↵

59

         * @return The hashcode↵

60

         */↵

60

         */↵

61

        public int hashCode() {↵

61

        public int hashCode() {↵

62

            return this.name.hashCode();↵

62

            return this.name.hashCode();↵

63

        }↵

63

        }↵

64

        ↵

64

        /**↵

65

        /**↵

65

         * Ensures that serialization returns the unique instances.↵

66

         * Ensures that serialization returns the unique instances.↵

66

         * ↵

67

         * ↵

67

         * @return The object.↵

68

         * @return The object.↵

68

         * ↵

69

         * ↵

69

         * @throws ObjectStreamException if there is a problem.↵

70

         * @throws ObjectStreamException if there is a problem.↵

70

         */↵

71

         */↵

71

        private Object readResolve() throws ObjectStreamException {↵

72

        private Object readResolve() throws ObjectStreamException {↵

72

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

73

            if (this.equals(TimePeriodAnchor.START)) {↵

73

                return RangeType.FULL;↵

74

                return TimePeriodAnchor.START;↵

74

            }↵

75

            }↵

75

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

76

            else if (this.equals(TimePeriodAnchor.MIDDLE)) {↵

76

                return RangeType.POSITIVE;↵

77

                return TimePeriodAnchor.MIDDLE;↵

77

            }↵

78

            }↵

78

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

79

            else if (this.equals(TimePeriodAnchor.END)) {↵

79

                return RangeType.NEGATIVE;↵

80

                return TimePeriodAnchor.END;↵

80

            }↵

81

            }↵

81

            return null;↵

82

            return null;↵

82

83

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