1 42 43 package org.jfree.chart.event; 44 45 import java.io.ObjectStreamException ; 46 import java.io.Serializable ; 47 48 51 public final class ChartChangeEventType implements Serializable { 52 53 54 private static final long serialVersionUID = 5481917022435735602L; 55 56 57 public static final ChartChangeEventType GENERAL 58 = new ChartChangeEventType("ChartChangeEventType.GENERAL"); 59 60 61 public static final ChartChangeEventType NEW_DATASET 62 = new ChartChangeEventType("ChartChangeEventType.NEW_DATASET"); 63 64 65 public static final ChartChangeEventType DATASET_UPDATED 66 = new ChartChangeEventType("ChartChangeEventType.DATASET_UPDATED"); 67 68 69 private String name; 70 71 76 private ChartChangeEventType(String name) { 77 this.name = name; 78 } 79 80 85 public String toString() { 86 return this.name; 87 } 88 89 97 public boolean equals(Object obj) { 98 if (this == obj) { 99 return true; 100 } 101 if (!(obj instanceof ChartChangeEventType)) { 102 return false; 103 } 104 ChartChangeEventType that = (ChartChangeEventType) obj; 105 if (!this.name.equals(that.toString())) { 106 return false; 107 } 108 return true; 109 } 110 111 116 public int hashCode() { 117 return this.name.hashCode(); 118 } 119 120 127 private Object readResolve() throws ObjectStreamException { 128 if (this.equals(ChartChangeEventType.GENERAL)) { 129 return ChartChangeEventType.GENERAL; 130 } 131 else if (this.equals(ChartChangeEventType.NEW_DATASET)) { 132 return ChartChangeEventType.NEW_DATASET; 133 } 134 else if (this.equals(ChartChangeEventType.DATASET_UPDATED)) { 135 return ChartChangeEventType.DATASET_UPDATED; 136 } 137 return null; 138 } 139 140 } 141 | Popular Tags |