1 42 43 package org.jfree.ui; 44 45 import java.io.ObjectStreamException ; 46 import java.io.Serializable ; 47 48 54 public final class HorizontalAlignment implements Serializable { 55 56 57 private static final long serialVersionUID = -8249740987565309567L; 58 59 60 public static final HorizontalAlignment LEFT 61 = new HorizontalAlignment("HorizontalAlignment.LEFT"); 62 63 64 public static final HorizontalAlignment RIGHT 65 = new HorizontalAlignment("HorizontalAlignment.RIGHT"); 66 67 68 public static final HorizontalAlignment CENTER 69 = new HorizontalAlignment("HorizontalAlignment.CENTER"); 70 71 72 private String name; 73 74 79 private HorizontalAlignment(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 obj) { 101 if (this == obj) { 102 return true; 103 } 104 if (!(obj instanceof HorizontalAlignment)) { 105 return false; 106 } 107 final HorizontalAlignment that = (HorizontalAlignment) obj; 108 if (!this.name.equals(that.name)) { 109 return false; 110 } 111 return true; 112 } 113 114 119 public int hashCode() { 120 return this.name.hashCode(); 121 } 122 123 130 private Object readResolve() throws ObjectStreamException { 131 HorizontalAlignment result = null; 132 if (this.equals(HorizontalAlignment.LEFT)) { 133 result = HorizontalAlignment.LEFT; 134 } 135 else if (this.equals(HorizontalAlignment.RIGHT)) { 136 result = HorizontalAlignment.RIGHT; 137 } 138 else if (this.equals(HorizontalAlignment.CENTER)) { 139 result = HorizontalAlignment.CENTER; 140 } 141 return result; 142 } 143 144 } 145 | Popular Tags |