1 28 package net.sf.jasperreports.olap.mapping; 29 30 import net.sf.jasperreports.engine.JRRuntimeException; 31 32 36 public class Axis 37 { 38 public static final String AXIS0 = "Columns"; 39 public static final String AXIS1 = "Rows"; 40 public static final String AXIS2 = "Pages"; 41 public static final String AXIS3 = "Chapters"; 42 public static final String AXIS4 = "Sections"; 43 public static final String [] AXIS_NAMES = new String []{AXIS0, AXIS1, AXIS2, AXIS3, AXIS4}; 44 45 public static final int getAxisIdx (String name) 46 { 47 for (int i = 0; i < AXIS_NAMES.length; i++) 48 { 49 if (AXIS_NAMES[i].equals(name)) 50 { 51 return i; 52 } 53 } 54 55 throw new JRRuntimeException("No such axis \"" + name + "\"."); 56 } 57 58 private final int idx; 59 60 public Axis (int idx) 61 { 62 this.idx = idx; 63 } 64 65 public Axis (String name) 66 { 67 this.idx = getAxisIdx(name); 68 } 69 70 public int getIdx () 71 { 72 return idx; 73 } 74 75 public String toString () 76 { 77 return "Axis(" + idx +")"; 78 } 79 } 80 | Popular Tags |