/** * 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(HistogramType.FREQUENCY)) { return HistogramType.FREQUENCY; } else if (this.equals(HistogramType.RELATIVE_FREQUENCY)) { return HistogramType.RELATIVE_FREQUENCY; } else if (this.equals(HistogramType.SCALE_AREA_TO_1)) { return HistogramType.SCALE_AREA_TO_1; } return null; }