1 42 43 package org.jfree.data.statistics; 44 45 import java.io.ObjectStreamException ; 46 import java.io.Serializable ; 47 48 52 public class HistogramType implements Serializable { 53 54 55 private static final long serialVersionUID = 2618927186251997727L; 56 57 58 public static final HistogramType FREQUENCY 59 = new HistogramType("FREQUENCY"); 60 61 62 public static final HistogramType RELATIVE_FREQUENCY 63 = new HistogramType("RELATIVE_FREQUENCY"); 64 65 66 public static final HistogramType SCALE_AREA_TO_1 67 = new HistogramType("SCALE_AREA_TO_1"); 68 69 70 private String name; 71 72 77 private HistogramType(String name) { 78 this.name = name; 79 } 80 81 86 public String toString() { 87 return this.name; 88 } 89 90 97 public boolean equals(Object obj) { 98 99 if (obj == null) { 100 return false; 101 } 102 103 if (obj == this) { 104 return true; 105 } 106 107 if (!(obj instanceof HistogramType)) { 108 return false; 109 } 110 111 HistogramType t = (HistogramType) obj; 112 if (!this.name.equals(t.name)) { 113 return false; 114 } 115 116 return true; 117 118 } 119 120 125 public int hashCode() { 126 return this.name.hashCode(); 127 } 128 129 136 private Object readResolve() throws ObjectStreamException { 137 if (this.equals(HistogramType.FREQUENCY)) { 138 return HistogramType.FREQUENCY; 139 } 140 else if (this.equals(HistogramType.RELATIVE_FREQUENCY)) { 141 return HistogramType.RELATIVE_FREQUENCY; 142 } 143 else if (this.equals(HistogramType.SCALE_AREA_TO_1)) { 144 return HistogramType.SCALE_AREA_TO_1; 145 } 146 return null; 147 } 148 149 } 150 151 | Popular Tags |