1 42 43 package org.jfree.chart.plot; 44 45 import java.io.ObjectStreamException ; 46 import java.io.Serializable ; 47 48 51 public final class PlotOrientation implements Serializable { 52 53 54 private static final long serialVersionUID = -2508771828190337782L; 55 56 57 public static final PlotOrientation HORIZONTAL 58 = new PlotOrientation("PlotOrientation.HORIZONTAL"); 59 60 61 public static final PlotOrientation VERTICAL 62 = new PlotOrientation("PlotOrientation.VERTICAL"); 63 64 65 private String name; 66 67 72 private PlotOrientation(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 o) { 94 95 if (this == o) { 96 return true; 97 } 98 if (!(o instanceof PlotOrientation)) { 99 return false; 100 } 101 102 PlotOrientation orientation = (PlotOrientation) o; 103 if (!this.name.equals(orientation.toString())) { 104 return false; 105 } 106 107 return true; 108 109 } 110 111 118 private Object readResolve() throws ObjectStreamException { 119 Object result = null; 120 if (this.equals(PlotOrientation.HORIZONTAL)) { 121 result = PlotOrientation.HORIZONTAL; 122 } 123 else if (this.equals(PlotOrientation.VERTICAL)) { 124 result = PlotOrientation.VERTICAL; 125 } 126 return result; 127 } 128 129 } 130 | Popular Tags |