1 28 package net.sf.jasperreports.olap.mondrian; 29 30 import net.sf.jasperreports.olap.result.JROlapHierarchy; 31 import net.sf.jasperreports.olap.result.JROlapMemberTuple; 32 import net.sf.jasperreports.olap.result.JROlapResultAxis; 33 import mondrian.olap.Axis; 34 import mondrian.olap.Hierarchy; 35 import mondrian.olap.Position; 36 37 38 42 public class JRMondrianAxis implements JROlapResultAxis 43 { 44 45 private final JRMondrianTuple[] tuples; 46 private final JRMondrianHierarchy[] hierarchies; 47 48 public JRMondrianAxis(Axis axis, Hierarchy[] axisHierarchies, JRMondrianFactory factory) 49 { 50 Position[] positions = axis.positions; 51 tuples = new JRMondrianTuple[positions.length]; 52 for (int i = 0; i < positions.length; i++) 53 { 54 tuples[i] = new JRMondrianTuple(positions[i], factory); 55 } 56 57 hierarchies = new JRMondrianHierarchy[axisHierarchies.length]; 58 for (int i = 0; i < axisHierarchies.length; i++) 59 { 60 hierarchies[i] = new JRMondrianHierarchy(axisHierarchies[i]); 61 } 62 } 63 64 public JROlapHierarchy[] getHierarchiesOnAxis() 65 { 66 return hierarchies; 67 } 68 69 public JROlapMemberTuple getTuple(int index) 70 { 71 if (index < 0 || index >= tuples.length) 72 { 73 throw new IndexOutOfBoundsException ("Index: " + index + ", Size: " + tuples.length); 74 } 75 76 return tuples[index]; 77 } 78 79 public int getTupleCount() 80 { 81 return tuples.length; 82 } 83 84 } 85 | Popular Tags |