public final class LengthConstraintType implements Serializable { /** For serialization. */ private static final long serialVersionUID = -1156658804028142978L; /** NONE. */ public static final LengthConstraintType NONE = new LengthConstraintType("LengthConstraintType.NONE"); /** Range. */ public static final LengthConstraintType RANGE = new LengthConstraintType("RectangleConstraintType.RANGE"); /** FIXED. */ public static final LengthConstraintType FIXED = new LengthConstraintType("LengthConstraintType.FIXED"); /** The name. */ private String name; /** * Private constructor. * * @param name the name. */ private LengthConstraintType(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 LengthConstraintType)) { return false; } LengthConstraintType that = (LengthConstraintType) 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(LengthConstraintType.NONE)) { return LengthConstraintType.NONE; } else if (this.equals(LengthConstraintType.RANGE)) { return LengthConstraintType.RANGE; } else if (this.equals(LengthConstraintType.FIXED)) { return LengthConstraintType.FIXED; } 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 <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
Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/chart/block/LengthConstraintType.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 LengthConstraintType implements Serializable {
1
public final class DialShape implements Serializable {
2
    /** For serialization. */
2
    /** For serialization. */
3
    private static final long serialVersionUID = -1156658804028142978L;
3
    private static final long serialVersionUID = -3471933055190251131L;
4
    
4
    
5
    /** NONE. */
5
    /** Circle. */
6
    public static final LengthConstraintType NONE 
6
    public static final 
7
        = new LengthConstraintType("LengthConstraintType.NONE");
7
DialShape CIRCLE = new DialShape("DialShape.CIRCLE");
8
    /** Range. */
8
    /** Chord. */
9
    public static final LengthConstraintType RANGE 
9
    public static final 
10
        = new LengthConstraintType("RectangleConstraintType.RANGE");
10
DialShape CHORD = new DialShape("DialShape.CHORD");
11
    /** FIXED. */
11
    /** Pie. */
12
    public static final LengthConstraintType FIXED 
12
    public static final 
13
        = new LengthConstraintType("LengthConstraintType.FIXED");
13
DialShape PIE = new DialShape("DialShape.PIE");
14
    /** The name. */
14
    /** The name. */
15
    private String name;
15
    private String name;
16
    /**
16
    /**
17
     * Private constructor.
17
     * Private constructor.
18
     *
18
     *
19
     * @param name  the name.
19
     * @param name  the name.
20
     */
20
     */
21
    private LengthConstraintType(String name) {
21
    private DialShape(String name) {
22
        this.name = name;
22
        this.name = name;
23
    }
23
    }
24
    /**
24
    /**
25
     * Returns a string representing the object.
25
     * Returns a string representing the object.
26
     *
26
     *
27
     * @return The string.
27
     * @return The string.
28
     */
28
     */
29
    public String toString() {
29
    public String toString() {
30
        return this.name;
30
        return this.name;
31
    }
31
    }
32
    /**
32
    /**
33
     * Returns <code>true</code> if this object is equal to the specified 
33
     * Returns <code>true</code> if this object is equal to the specified 
34
     * object, and <code>false</code> otherwise.
34
     * object, and <code>false</code> otherwise.
35
     *
35
     *
36
     * @param obj  the object (<code>null</code> permitted).
36
     * @param obj  the other object.
37
     *
37
     *
38
     * @return A boolean.
38
     * @return A boolean.
39
     */
39
     */
40
    public boolean equals(Object obj) {
40
    public boolean equals(Object obj) {
41
        if (this == obj) {
41
        if (this == obj) {
42
            return true;
42
            return true;
43
        }
43
        }
44
        if (!(obj instanceof LengthConstraintType)) {
44
        if (!(obj instanceof DialShape)) {
45
            return false;
45
            return false;
46
        }
46
        }
47
        LengthConstraintType that = (LengthConstraintType) obj;
47
        DialShape shape = (DialShape) obj;
48
        if (!this.name.equals(that.toString())) {
48
        if (!this.name.equals(shape.toString())) {
49
            return false;
49
            return false;
50
        }
50
        }
51
        return true;
51
        return true;
52
    }
52
    }
53
    
53
    
54
    /**
54
    /**
55
     * Returns a hash code value for the object.
55
     * Returns a hash code for this instance.
56
     *
56
     * 
57
     * @return The hashcode
57
     * @return A hash code.
58
     */
58
     */
59
    public int hashCode() {
59
    public int hashCode() {
60
        return this.name.hashCode();
60
        return this.name.hashCode();
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(LengthConstraintType.NONE)) {
71
        if (this.equals(DialShape.CIRCLE)) {
71
            return LengthConstraintType.NONE;
72
            return DialShape.CIRCLE;
72
        }
73
        }
73
        else if (this.equals(LengthConstraintType.RANGE)) {
74
        else if (this.equals(
74
            return LengthConstraintType.RANGE
75
DialShape.CHORD)) {
75
;
76
            return DialShape.CHORD;
76
        }
77
        }      
77
        else if (this.equals(LengthConstraintType.FIXED)) {
78
        else if (this.equals(DialShape.PIE)) {
78
            return LengthConstraintType.FIXED;
79
            return DialShape.PIE;
79
        }
80
        }      
80
        return null
81
        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