1 41 42 package org.jfree.chart.plot; 43 44 import java.io.ObjectStreamException ; 45 import java.io.Serializable ; 46 47 51 public final class DialShape implements Serializable { 52 53 54 private static final long serialVersionUID = -3471933055190251131L; 55 56 57 public static final DialShape CIRCLE = new DialShape("DialShape.CIRCLE"); 58 59 60 public static final DialShape CHORD = new DialShape("DialShape.CHORD"); 61 62 63 public static final DialShape PIE = new DialShape("DialShape.PIE"); 64 65 66 private String name; 67 68 73 private DialShape(String name) { 74 this.name = name; 75 } 76 77 82 public String toString() { 83 return this.name; 84 } 85 86 94 public boolean equals(Object obj) { 95 if (this == obj) { 96 return true; 97 } 98 if (!(obj instanceof DialShape)) { 99 return false; 100 } 101 DialShape shape = (DialShape) obj; 102 if (!this.name.equals(shape.toString())) { 103 return false; 104 } 105 return true; 106 } 107 108 115 private Object readResolve() throws ObjectStreamException { 116 if (this.equals(DialShape.CIRCLE)) { 117 return DialShape.CIRCLE; 118 } 119 else if (this.equals(DialShape.CHORD)) { 120 return DialShape.CHORD; 121 } 122 else if (this.equals(DialShape.PIE)) { 123 return DialShape.PIE; 124 } 125 return null; 126 } 127 128 } 129 | Popular Tags |