public final class CategoryAnchor implements Serializable { /** For serialization. */ private static final long serialVersionUID = -2604142742210173810L; /** Start of period. */ public static final CategoryAnchor START = new CategoryAnchor("CategoryAnchor.START"); /** Middle of period. */ public static final CategoryAnchor MIDDLE = new CategoryAnchor("CategoryAnchor.MIDDLE"); /** End of period. */ public static final CategoryAnchor END = new CategoryAnchor("CategoryAnchor.END"); /** The name. */ private String name; /** * Private constructor. * * @param name the name. */ private CategoryAnchor(String name) { this.name = name; } /** * Returns a string representing the object. * * @return The string. */ public String toString() { return this.name; } /** * Returns true if this object is equal to the specified * object, and false otherwise. * * @param obj the other object. * * @return A boolean. */ public boolean equals(Object obj) { if (this == obj) { return true; } if (!(obj instanceof CategoryAnchor)) { return false; } CategoryAnchor position = (CategoryAnchor) obj; if (!this.name.equals(position.toString())) { return false; } return true; } /** * 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(CategoryAnchor.START)) { return CategoryAnchor.START; } else if (this.equals(CategoryAnchor.MIDDLE)) { return CategoryAnchor.MIDDLE; } else if (this.equals(CategoryAnchor.END)) { return CategoryAnchor.END; } 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 true if this object is equal to the specified * object, and false 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/axis/CategoryAnchor.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 CategoryAnchor implements Serializable {
1
public final class RangeType implements Serializable {
2
    /** For serialization. */
2
    /** For serialization. */
3
    private static final long serialVersionUID = -2604142742210173810L;
3
    private static final long serialVersionUID = -9073319010650549239L;
4
    
4
     
5
    /** Start of period. */
5
    /** 
6
    public static final CategoryAnchor START 
7
        = new CategoryAnchor("CategoryAnchor.START");
8
    /** Middle of period
6
Full range (positive and negative). */
7
    public static final RangeType FULL = new RangeType("RangeType.FULL");
9
. */
8
    /** Positive range. */
10
    public static final CategoryAnchor MIDDLE 
9
    public static final RangeType POSITIVE 
11
        = new CategoryAnchor("CategoryAnchor.MIDDLE");
10
        = new RangeType("RangeType.POSITIVE");
12
    /** End of period. */
11
    /** Negative range. */
13
    public static final CategoryAnchor END 
12
    public static final RangeType NEGATIVE 
14
        = new CategoryAnchor("CategoryAnchor.END");
13
        = new RangeType("RangeType.NEGATIVE");
15
    /** The name. */
14
    /** The name. */
16
    private String name;
15
    private String name;
17
    /**
16
    /**
18
     * Private constructor.
17
     * Private constructor.
19
     *
18
     *
20
     * @param name  the name.
19
     * @param name  the name.
21
     */
20
     */
22
    private CategoryAnchor(String name) {
21
    private RangeType(String name) {
23
        this.name = name;
22
        this.name = name;
24
    }
23
    }
25
    /**
24
    /**
26
     * Returns a string representing the object.
25
     * Returns a string representing the object.
27
     *
26
     *
28
     * @return The string.
27
     * @return The string.
29
     */
28
     */
30
    public String toString() {
29
    public String toString() {
31
        return this.name;
30
        return this.name;
32
    }
31
    }
33
    /**
32
    /**
34
     * Returns true if this object is equal to the specified 
33
     * Returns true if this object is equal to the specified 
35
     * object, and false otherwise.
34
     * object, and false otherwise.
36
     *
35
     *
37
     * @param obj  the other object.
36
     * @param obj  the other object.
38
     *
37
     *
39
     * @return A boolean.
38
     * @return A boolean.
40
     */
39
     */
41
    public boolean equals(Object obj) {
40
    public boolean equals(Object obj) {
42
        if (this == obj) {
41
        if (this == obj) {
43
            return true;
42
            return true;
44
        }
43
        }
45
        if (!(obj instanceof CategoryAnchor)) {
44
        if (!(obj instanceof RangeType)) {
46
            return false;
45
            return false;
47
        }
46
        }
48
        CategoryAnchor position = (CategoryAnchor) obj;
47
        RangeType that = (RangeType) obj;
49
        if (!this.name.equals(position.toString())) {
48
        if (!this.name.equals(that.toString())) {
50
            return false;
49
            return false;
51
        }
50
        }
52
        return true;
51
        return true;
52
    }
53
    }
53
    
54
    
54
    /**
55
     * Returns a hash code value for the object.
56
     *
57
     * @return The hashcode
58
     */
59
    public int hashCode() {
60
        return this.name.hashCode();
61
    }
55
    /**
62
    /**
56
     * Ensures that serialization returns the unique instances.
63
     * Ensures that serialization returns the unique instances.
57
     * 
64
     * 
58
     * @return The object.
65
     * @return The object.
59
     * 
66
     * 
60
     * @throws ObjectStreamException if there is a problem.
67
     * @throws ObjectStreamException if there is a problem.
61
     */
68
     */
62
    private Object readResolve() throws ObjectStreamException {
69
    private Object readResolve() throws ObjectStreamException {
63
        if (this.equals(CategoryAnchor.START)) {
70
        if (this.equals(RangeType.FULL)) {
64
            return CategoryAnchor.START;
71
            return RangeType.FULL;
65
        }
72
        }
66
        else if (this.equals(CategoryAnchor.MIDDLE)) {
73
        else if (this.equals(RangeType.POSITIVE)) {
67
            return CategoryAnchor.MIDDLE;
74
            return RangeType.POSITIVE;
68
        }    
75
        }
69
        else if (this.equals(CategoryAnchor.END)) {
76
        else if (this.equals(RangeType.NEGATIVE)) {
70
            return CategoryAnchor.END;
77
            return RangeType.NEGATIVE;
71
        }    
78
        }
72
        return null;
79
        return null;
73
    
80
    
Summary
Number of common nesting structure subtrees0
Number of refactorable cases0
Number of non-refactorable cases0
Time elapsed for finding largest common nesting structure subtrees (ms)0.0
Clones location
Number of node comparisons0