1 42 43 package org.jfree.chart; 44 45 import java.io.ObjectStreamException ; 46 import java.io.Serializable ; 47 48 51 public final class LegendRenderingOrder implements Serializable { 52 53 54 private static final long serialVersionUID = -3832486612685808616L; 55 56 57 public static final LegendRenderingOrder STANDARD 58 = new LegendRenderingOrder("LegendRenderingOrder.STANDARD"); 59 60 61 public static final LegendRenderingOrder REVERSE 62 = new LegendRenderingOrder("LegendRenderingOrder.REVERSE"); 63 64 65 private String name; 66 67 72 private LegendRenderingOrder(String name) { 73 this.name = name; 74 } 75 76 81 public String toString() { 82 return this.name; 83 } 84 85 93 public boolean equals(Object obj) { 94 if (this == obj) { 95 return true; 96 } 97 if (!(obj instanceof LegendRenderingOrder)) { 98 return false; 99 } 100 LegendRenderingOrder order = (LegendRenderingOrder) obj; 101 if (!this.name.equals(order.toString())) { 102 return false; 103 } 104 return true; 105 } 106 107 114 private Object readResolve() throws ObjectStreamException { 115 if (this.equals(LegendRenderingOrder.STANDARD)) { 116 return LegendRenderingOrder.STANDARD; 117 } 118 else if (this.equals(LegendRenderingOrder.REVERSE)) { 119 return LegendRenderingOrder.REVERSE; 120 } 121 return null; 122 } 123 124 } 125 | Popular Tags |