1 10 package mondrian.mdx; 11 12 import mondrian.olap.*; 13 import mondrian.olap.type.HierarchyType; 14 import mondrian.olap.type.Type; 15 import mondrian.calc.*; 16 import mondrian.calc.impl.ConstantCalc; 17 18 25 public class HierarchyExpr extends ExpBase implements Exp { 26 private final Hierarchy hierarchy; 27 28 34 public HierarchyExpr(Hierarchy hierarchy) { 35 Util.assertPrecondition(hierarchy != null, "hierarchy != null"); 36 this.hierarchy = hierarchy; 37 } 38 39 44 public Hierarchy getHierarchy() { 45 return hierarchy; 46 } 47 48 public String toString() { 49 return hierarchy.getUniqueName(); 50 } 51 52 public Type getType() { 53 return HierarchyType.forHierarchy(hierarchy); 54 } 55 56 public HierarchyExpr clone() { 57 return new HierarchyExpr(hierarchy); 58 } 59 60 public int getCategory() { 61 return Category.Hierarchy; 62 } 63 64 public Exp accept(Validator validator) { 65 return this; 66 } 67 68 public Calc accept(ExpCompiler compiler) { 69 return ConstantCalc.constantHierarchy(hierarchy); 70 } 71 72 public Object accept(MdxVisitor visitor) { 73 return visitor.visit(this); 74 } 75 } 76 77 | Popular Tags |