1 45 46 package org.jfree.chart.axis; 47 48 import java.io.Serializable ; 49 50 62 public abstract class TickUnit implements Comparable , Serializable { 63 64 65 private static final long serialVersionUID = 510179855057013974L; 66 67 68 private double size; 69 70 75 public TickUnit(double size) { 76 this.size = size; 77 } 78 79 84 public double getSize() { 85 return this.size; 86 } 87 88 97 public String valueToString(double value) { 98 return String.valueOf(value); 99 } 100 101 110 public int compareTo(Object object) { 111 112 if (object instanceof TickUnit) { 113 TickUnit other = (TickUnit) object; 114 if (this.size > other.getSize()) { 115 return 1; 116 } 117 else if (this.size < other.getSize()) { 118 return -1; 119 } 120 else { 121 return 0; 122 } 123 } 124 else { 125 return -1; 126 } 127 128 } 129 130 137 public boolean equals(Object obj) { 138 139 if (obj == null) { 140 return false; 141 } 142 if (obj == this) { 143 return true; 144 } 145 if (obj instanceof TickUnit) { 146 TickUnit tu = (TickUnit) obj; 147 return this.size == tu.size; 148 } 149 return false; 150 151 } 152 153 } 154 | Popular Tags |