1 10 package mondrian.mdx; 11 12 import mondrian.olap.*; 13 import mondrian.olap.type.Type; 14 import mondrian.calc.*; 15 import mondrian.calc.impl.AbstractListCalc; 16 17 import java.util.List ; 18 19 26 public class NamedSetExpr extends ExpBase implements Exp { 27 private final NamedSet namedSet; 28 29 35 public NamedSetExpr(NamedSet namedSet) { 36 Util.assertPrecondition(namedSet != null, "namedSet != null"); 37 this.namedSet = namedSet; 38 } 39 40 45 public NamedSet getNamedSet() { 46 return namedSet; 47 } 48 49 public String toString() { 50 return namedSet.getUniqueName(); 51 } 52 53 public NamedSetExpr clone() { 54 return new NamedSetExpr(namedSet); 55 } 56 57 public int getCategory() { 58 return Category.Set; 59 } 60 61 public Exp accept(Validator validator) { 62 NamedSet namedSet2 = namedSet.validate(validator); 69 if (namedSet2 == namedSet) { 70 return this; 71 } 72 return new NamedSetExpr(namedSet2); 73 } 74 75 public Calc accept(ExpCompiler compiler) { 76 return new AbstractListCalc(this, new Calc[] { }, false) { 77 public List evaluateList(Evaluator evaluator) { 78 return (List ) evaluator.evaluateNamedSet( 79 namedSet.getName(), namedSet.getExp()); 80 } 81 82 public boolean dependsOn(Dimension dimension) { 83 return false; 86 } 87 }; 88 } 89 90 public Object accept(MdxVisitor visitor) { 91 Object o = visitor.visit(this); 92 namedSet.getExp().accept(visitor); 93 return o; 94 } 95 96 public Type getType() { 97 return namedSet.getType(); 98 } 99 } 100 101 | Popular Tags |