1 42 43 package org.jfree.chart.axis; 44 45 import org.jfree.text.TextBlock; 46 import org.jfree.text.TextBlockAnchor; 47 import org.jfree.ui.TextAnchor; 48 import org.jfree.util.ObjectUtilities; 49 50 53 public class CategoryTick extends Tick { 54 55 56 private Comparable category; 57 58 59 private TextBlock label; 60 61 62 private TextBlockAnchor labelAnchor; 63 64 73 public CategoryTick(Comparable category, 74 TextBlock label, 75 TextBlockAnchor labelAnchor, 76 TextAnchor rotationAnchor, 77 double angle) { 78 79 super("", TextAnchor.CENTER, rotationAnchor, angle); 80 this.category = category; 81 this.label = label; 82 this.labelAnchor = labelAnchor; 83 84 } 85 86 91 public Comparable getCategory() { 92 return this.category; 93 } 94 95 100 public TextBlock getLabel() { 101 return this.label; 102 } 103 104 109 public TextBlockAnchor getLabelAnchor() { 110 return this.labelAnchor; 111 } 112 113 120 public boolean equals(Object obj) { 121 if (this == obj) { 122 return true; 123 } 124 if (obj instanceof CategoryTick && super.equals(obj)) { 125 CategoryTick that = (CategoryTick) obj; 126 if (!ObjectUtilities.equal(this.category, that.category)) { 127 return false; 128 } 129 if (!ObjectUtilities.equal(this.label, that.label)) { 130 return false; 131 } 132 if (!ObjectUtilities.equal(this.labelAnchor, that.labelAnchor)) { 133 return false; 134 } 135 return true; 136 } 137 return false; 138 } 139 140 145 public int hashCode() { 146 int result = 41; 147 result = 37 * result + this.category.hashCode(); 148 result = 37 * result + this.label.hashCode(); 149 result = 37 * result + this.labelAnchor.hashCode(); 150 return result; 151 } 152 } 153 | Popular Tags |