1 42 43 package org.jfree.data; 44 45 import java.io.ObjectStreamException ; 46 import java.io.Serializable ; 47 48 52 public final class RangeType implements Serializable { 53 54 55 private static final long serialVersionUID = -9073319010650549239L; 56 57 58 public static final RangeType FULL = new RangeType("RangeType.FULL"); 59 60 61 public static final RangeType POSITIVE 62 = new RangeType("RangeType.POSITIVE"); 63 64 65 public static final RangeType NEGATIVE 66 = new RangeType("RangeType.NEGATIVE"); 67 68 69 private String name; 70 71 76 private RangeType(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 99 if (this == obj) { 100 return true; 101 } 102 if (!(obj instanceof RangeType)) { 103 return false; 104 } 105 RangeType that = (RangeType) obj; 106 if (!this.name.equals(that.toString())) { 107 return false; 108 } 109 return true; 110 } 111 112 117 public int hashCode() { 118 return this.name.hashCode(); 119 } 120 121 128 private Object readResolve() throws ObjectStreamException { 129 if (this.equals(RangeType.FULL)) { 130 return RangeType.FULL; 131 } 132 else if (this.equals(RangeType.POSITIVE)) { 133 return RangeType.POSITIVE; 134 } 135 else if (this.equals(RangeType.NEGATIVE)) { 136 return RangeType.NEGATIVE; 137 } 138 return null; 139 } 140 141 } 142 | Popular Tags |