1 42 43 package org.jfree.util; 44 45 import java.io.ObjectStreamException ; 46 import java.io.Serializable ; 47 48 53 public final class TableOrder implements Serializable { 54 55 56 private static final long serialVersionUID = 525193294068177057L; 57 58 59 public static final TableOrder BY_ROW = new TableOrder("TableOrder.BY_ROW"); 60 61 62 public static final TableOrder BY_COLUMN 63 = new TableOrder("TableOrder.BY_COLUMN"); 64 65 66 private String name; 67 68 73 private TableOrder(String name) { 74 this.name = name; 75 } 76 77 82 public String toString() { 83 return this.name; 84 } 85 86 94 public boolean equals(Object obj) { 95 if (this == obj) { 96 return true; 97 } 98 if (!(obj instanceof TableOrder)) { 99 return false; 100 } 101 TableOrder that = (TableOrder) obj; 102 if (!this.name.equals(that.name)) { 103 return false; 104 } 105 return true; 106 } 107 108 113 public int hashCode() { 114 return this.name.hashCode(); 115 } 116 117 124 private Object readResolve() throws ObjectStreamException { 125 if (this.equals(TableOrder.BY_ROW)) { 126 return TableOrder.BY_ROW; 127 } 128 else if (this.equals(TableOrder.BY_COLUMN)) { 129 return TableOrder.BY_COLUMN; 130 } 131 return null; 132 } 133 134 } 135 | Popular Tags |