1 42 43 package org.jfree.ui; 44 45 import java.io.ObjectStreamException ; 46 import java.io.Serializable ; 47 48 54 public final class VerticalAlignment implements Serializable { 55 56 57 private static final long serialVersionUID = 7272397034325429853L; 58 59 60 public static final VerticalAlignment TOP 61 = new VerticalAlignment("VerticalAlignment.TOP"); 62 63 64 public static final VerticalAlignment BOTTOM 65 = new VerticalAlignment("VerticalAlignment.BOTTOM"); 66 67 68 public static final VerticalAlignment CENTER 69 = new VerticalAlignment("VerticalAlignment.CENTER"); 70 71 72 private String name; 73 74 79 private VerticalAlignment(final String name) { 80 this.name = name; 81 } 82 83 88 public String toString() { 89 return this.name; 90 } 91 92 100 public boolean equals(final Object o) { 101 102 if (this == o) { 103 return true; 104 } 105 if (!(o instanceof VerticalAlignment)) { 106 return false; 107 } 108 109 final VerticalAlignment alignment = (VerticalAlignment) o; 110 if (!this.name.equals(alignment.name)) { 111 return false; 112 } 113 114 return true; 115 } 116 117 122 public int hashCode() { 123 return this.name.hashCode(); 124 } 125 126 133 private Object readResolve() throws ObjectStreamException { 134 if (this.equals(VerticalAlignment.TOP)) { 135 return VerticalAlignment.TOP; 136 } 137 else if (this.equals(VerticalAlignment.BOTTOM)) { 138 return VerticalAlignment.BOTTOM; 139 } 140 else if (this.equals(VerticalAlignment.CENTER)) { 141 return VerticalAlignment.CENTER; 142 } 143 else { 144 return null; } 146 } 147 148 } 149 | Popular Tags |