1 42 43 package org.jfree.chart.block; 44 45 import java.io.ObjectStreamException ; 46 import java.io.Serializable ; 47 48 51 public final class LengthConstraintType implements Serializable { 52 53 54 private static final long serialVersionUID = -1156658804028142978L; 55 56 57 public static final LengthConstraintType NONE 58 = new LengthConstraintType("LengthConstraintType.NONE"); 59 60 61 public static final LengthConstraintType RANGE 62 = new LengthConstraintType("RectangleConstraintType.RANGE"); 63 64 65 public static final LengthConstraintType FIXED 66 = new LengthConstraintType("LengthConstraintType.FIXED"); 67 68 69 private String name; 70 71 76 private LengthConstraintType(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 LengthConstraintType)) { 102 return false; 103 } 104 LengthConstraintType that = (LengthConstraintType) 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(LengthConstraintType.NONE)) { 129 return LengthConstraintType.NONE; 130 } 131 else if (this.equals(LengthConstraintType.RANGE)) { 132 return LengthConstraintType.RANGE; 133 } 134 else if (this.equals(LengthConstraintType.FIXED)) { 135 return LengthConstraintType.FIXED; 136 } 137 return null; 138 } 139 140 } 141 | Popular Tags |