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