1 42 43 package org.jfree.chart.axis; 44 45 import java.io.ObjectStreamException ; 46 import java.io.Serializable ; 47 48 51 public final class CategoryLabelWidthType implements Serializable { 52 53 54 private static final long serialVersionUID = -6976024792582949656L; 55 56 57 public static final CategoryLabelWidthType 58 CATEGORY = new CategoryLabelWidthType( 59 "CategoryLabelWidthType.CATEGORY" 60 ); 61 62 63 public static final CategoryLabelWidthType 64 RANGE = new CategoryLabelWidthType("CategoryLabelWidthType.RANGE"); 65 66 67 private String name; 68 69 74 private CategoryLabelWidthType(String name) { 75 if (name == null) { 76 throw new IllegalArgumentException ("Null 'name' argument."); 77 } 78 this.name = name; 79 } 80 81 86 public String toString() { 87 return this.name; 88 } 89 90 98 public boolean equals(Object obj) { 99 100 if (this == obj) { 101 return true; 102 } 103 if (!(obj instanceof CategoryLabelWidthType)) { 104 return false; 105 } 106 CategoryLabelWidthType t = (CategoryLabelWidthType) obj; 107 if (!this.name.equals(t.toString())) { 108 return false; 109 } 110 return true; 111 112 } 113 114 121 private Object readResolve() throws ObjectStreamException { 122 if (this.equals(CategoryLabelWidthType.CATEGORY)) { 123 return CategoryLabelWidthType.CATEGORY; 124 } 125 else if (this.equals(CategoryLabelWidthType.RANGE)) { 126 return CategoryLabelWidthType.RANGE; 127 } 128 return null; 129 } 130 131 } 132 | Popular Tags |