1 46 47 package org.jfree.chart.axis; 48 49 import java.io.Serializable ; 50 51 56 public class SymbolicTickUnit extends NumberTickUnit implements Serializable { 57 58 59 private static final long serialVersionUID = -4836679837074745805L; 60 61 62 private String [] symbolicValue; 63 64 71 public SymbolicTickUnit(double size, String [] sv) { 72 super(size, null); 73 this.symbolicValue = new String [sv.length]; 74 System.arraycopy(sv, 0, this.symbolicValue, 0, sv.length); 75 } 76 77 86 public String valueToString(double value) { 87 88 if ((value < 0) || (value >= this.symbolicValue.length)) { 89 throw new IllegalArgumentException ( 90 "The value " + value 91 + " does not have a corresponding symbolic value" 92 ); 93 } 94 return this.symbolicValue[(int) value]; 95 } 96 97 102 public int getSymbolCount() { 103 return this.symbolicValue.length; 104 } 105 106 } 107 | Popular Tags |