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 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 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 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;
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/chart/plot/DialShape.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 DialShape implements Serializable {
2
    /** For serialization. */
2
    /** For serialization. */
3
    private static final long serialVersionUID = -2604142742210173810L;
3
    private static final long serialVersionUID = -3471933055190251131L;
4
    
4
    
5
    /** Start of period. */
5
    /** Circle. */
6
    public static final CategoryAnchor START 
6
    public static final 
7
        = new CategoryAnchor("CategoryAnchor.START");
8
    /** Middle of period. */
9
    public static final CategoryAnchor MIDDLE 
10
        = new CategoryAnchor("CategoryAnchor.MIDDLE
7
DialShape CIRCLE = new DialShape("DialShape.CIRCLE");
8
    /** Chord. */
11
");
9
    public static final DialShape CHORD = new DialShape("DialShape.CHORD");
12
    /** End of period. */
10
    /** Pie. */
13
    public static final CategoryAnchor END 
11
    public static final 
14
        = new CategoryAnchor("CategoryAnchor.END");
12
DialShape PIE = new DialShape("DialShape.PIE");
15
    /** The name. */
13
    /** The name. */
16
    private String name;
14
    private String name;
17
    /**
15
    /**
18
     * Private constructor.
16
     * Private constructor.
19
     *
17
     *
20
     * @param name  the name.
18
     * @param name  the name.
21
     */
19
     */
22
    private CategoryAnchor(String name) {
20
    private DialShape(String name) {
23
        this.name = name;
21
        this.name = name;
24
    }
22
    }
25
    /**
23
    /**
26
     * Returns a string representing the object.
24
     * Returns a string representing the object.
27
     *
25
     *
28
     * @return The string.
26
     * @return The string.
29
     */
27
     */
30
    public String toString() {
28
    public String toString() {
31
        return this.name;
29
        return this.name;
32
    }
30
    }
33
    /**
31
    /**
34
     * Returns true if this object is equal to the specified 
32
     * Returns true if this object is equal to the specified 
35
     * object, and false otherwise.
33
     * object, and false otherwise.
36
     *
34
     *
37
     * @param obj  the other object.
35
     * @param obj  the other object.
38
     *
36
     *
39
     * @return A boolean.
37
     * @return A boolean.
40
     */
38
     */
41
    public boolean equals(Object obj) {
39
    public boolean equals(Object obj) {
42
        if (this == obj) {
40
        if (this == obj) {
43
            return true;
41
            return true;
44
        }
42
        }
45
        if (!(obj instanceof CategoryAnchor)) {
43
        if (!(obj instanceof DialShape)) {
46
            return false;
44
            return false;
47
        }
45
        }
48
        CategoryAnchor position = (CategoryAnchor) obj;
46
        DialShape shape = (DialShape) obj;
49
        if (!this.name.equals(position.toString())) {
47
        if (!this.name.equals(shape.toString())) {
50
            return false;
48
            return false;
51
        }
49
        }
52
        return true;
50
        return true;
51
    }
52
    
53
    /**
54
     * Returns a hash code for this instance.
55
     * 
56
     * @return A hash code.
57
     */
58
    public int hashCode() {
59
        return this.name.hashCode();
53
    }
60
    }
54
    
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(DialShape.CIRCLE)) {
64
            return CategoryAnchor.START;
71
            return DialShape.CIRCLE;
65
        }
72
        }
66
        else if (this.equals(CategoryAnchor.MIDDLE)) {
73
        else if (this.equals(DialShape.CHORD)) {
67
            return CategoryAnchor.MIDDLE;
74
            return DialShape.CHORD;
68
        }    
75
        }      
69
        else if (this.equals(CategoryAnchor.END)) {
76
        else if (this.equals(DialShape.PIE)) {
70
            return CategoryAnchor.END;
77
            return DialShape.PIE;
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