1 42 43 package org.jfree.data; 44 45 import java.io.ObjectStreamException ; 46 import java.io.Serializable ; 47 48 51 public final class DomainOrder implements Serializable { 52 53 54 private static final long serialVersionUID = 4902774943512072627L; 55 56 57 public static final DomainOrder NONE = new DomainOrder("DomainOrder.NONE"); 58 59 60 public static final DomainOrder ASCENDING 61 = new DomainOrder("DomainOrder.ASCENDING"); 62 63 64 public static final DomainOrder DESCENDING 65 = new DomainOrder("DomainOrder.DESCENDING"); 66 67 68 private String name; 69 70 75 private DomainOrder(String name) { 76 this.name = name; 77 } 78 79 84 public String toString() { 85 return this.name; 86 } 87 88 96 public boolean equals(Object obj) { 97 98 if (this == obj) { 99 return true; 100 } 101 if (!(obj instanceof DomainOrder)) { 102 return false; 103 } 104 DomainOrder that = (DomainOrder) obj; 105 if (!this.name.equals(that.toString())) { 106 return false; 107 } 108 return true; 109 } 110 111 116 public int hashCode() { 117 return this.name.hashCode(); 118 } 119 120 127 private Object readResolve() throws ObjectStreamException { 128 if (this.equals(DomainOrder.ASCENDING)) { 129 return DomainOrder.ASCENDING; 130 } 131 else if (this.equals(DomainOrder.DESCENDING)) { 132 return DomainOrder.DESCENDING; 133 } 134 else if (this.equals(DomainOrder.NONE)) { 135 return DomainOrder.NONE; 136 } 137 return null; 138 } 139 140 } 141 | Popular Tags |