1 41 42 package org.jfree.chart.axis; 43 44 import java.io.ObjectStreamException ; 45 import java.io.Serializable ; 46 47 51 public final class CategoryAnchor implements Serializable { 52 53 54 private static final long serialVersionUID = -2604142742210173810L; 55 56 57 public static final CategoryAnchor START 58 = new CategoryAnchor("CategoryAnchor.START"); 59 60 61 public static final CategoryAnchor MIDDLE 62 = new CategoryAnchor("CategoryAnchor.MIDDLE"); 63 64 65 public static final CategoryAnchor END 66 = new CategoryAnchor("CategoryAnchor.END"); 67 68 69 private String name; 70 71 76 private CategoryAnchor(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 CategoryAnchor)) { 103 return false; 104 } 105 CategoryAnchor position = (CategoryAnchor) obj; 106 if (!this.name.equals(position.toString())) { 107 return false; 108 } 109 return true; 110 111 } 112 113 120 private Object readResolve() throws ObjectStreamException { 121 if (this.equals(CategoryAnchor.START)) { 122 return CategoryAnchor.START; 123 } 124 else if (this.equals(CategoryAnchor.MIDDLE)) { 125 return CategoryAnchor.MIDDLE; 126 } 127 else if (this.equals(CategoryAnchor.END)) { 128 return CategoryAnchor.END; 129 } 130 return null; 131 } 132 133 } 134 | Popular Tags |