1 46 47 package org.jfree.chart.axis; 48 49 import java.io.Serializable ; 50 51 import org.jfree.ui.TextAnchor; 52 import org.jfree.util.ObjectUtilities; 53 54 57 public abstract class Tick implements Serializable , Cloneable { 58 59 60 private static final long serialVersionUID = 6668230383875149773L; 61 62 63 private String text; 64 65 66 private TextAnchor textAnchor; 67 68 69 private TextAnchor rotationAnchor; 70 71 72 private double angle; 73 74 83 public Tick(String text, TextAnchor textAnchor, TextAnchor rotationAnchor, 84 double angle) { 85 if (textAnchor == null) { 86 throw new IllegalArgumentException ("Null 'textAnchor' argument."); 87 } 88 if (rotationAnchor == null) { 89 throw new IllegalArgumentException ( 90 "Null 'rotationAnchor' argument." 91 ); 92 } 93 this.text = text; 94 this.textAnchor = textAnchor; 95 this.rotationAnchor = rotationAnchor; 96 this.angle = angle; 97 } 98 99 104 public String getText() { 105 return this.text; 106 } 107 108 113 public TextAnchor getTextAnchor() { 114 return this.textAnchor; 115 } 116 117 123 public TextAnchor getRotationAnchor() { 124 return this.rotationAnchor; 125 } 126 127 132 public double getAngle() { 133 return this.angle; 134 } 135 136 143 public boolean equals(Object obj) { 144 if (this == obj) { 145 return true; 146 } 147 if (obj instanceof Tick) { 148 Tick t = (Tick) obj; 149 if (!ObjectUtilities.equal(this.text, t.text)) { 150 return false; 151 } 152 if (!ObjectUtilities.equal(this.textAnchor, t.textAnchor)) { 153 return false; 154 } 155 if (!ObjectUtilities.equal(this.rotationAnchor, t.rotationAnchor)) { 156 return false; 157 } 158 if (!(this.angle == t.angle)) { 159 return false; 160 } 161 return true; 162 } 163 return false; 164 } 165 166 173 public Object clone() throws CloneNotSupportedException { 174 Tick clone = (Tick) super.clone(); 175 return clone; 176 } 177 178 183 public String toString() { 184 return this.text; 185 } 186 } 187 | Popular Tags |