1 42 43 package org.jfree.data.time; 44 45 import java.io.ObjectStreamException ; 46 import java.io.Serializable ; 47 48 52 public final class TimePeriodAnchor implements Serializable { 53 54 55 private static final long serialVersionUID = 2011955697457548862L; 56 57 58 public static final TimePeriodAnchor START 59 = new TimePeriodAnchor("TimePeriodAnchor.START"); 60 61 62 public static final TimePeriodAnchor MIDDLE 63 = new TimePeriodAnchor("TimePeriodAnchor.MIDDLE"); 64 65 66 public static final TimePeriodAnchor END 67 = new TimePeriodAnchor("TimePeriodAnchor.END"); 68 69 70 private String name; 71 72 77 private TimePeriodAnchor(String name) { 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 TimePeriodAnchor)) { 104 return false; 105 } 106 107 TimePeriodAnchor position = (TimePeriodAnchor) obj; 108 if (!this.name.equals(position.name)) { 109 return false; 110 } 111 112 return true; 113 } 114 115 120 public int hashCode() { 121 return this.name.hashCode(); 122 } 123 124 131 private Object readResolve() throws ObjectStreamException { 132 if (this.equals(TimePeriodAnchor.START)) { 133 return TimePeriodAnchor.START; 134 } 135 else if (this.equals(TimePeriodAnchor.MIDDLE)) { 136 return TimePeriodAnchor.MIDDLE; 137 } 138 else if (this.equals(TimePeriodAnchor.END)) { 139 return TimePeriodAnchor.END; 140 } 141 return null; 142 } 143 144 } 145 | Popular Tags |