001/* 002// This software is subject to the terms of the Eclipse Public License v1.0 003// Agreement, available at the following URL: 004// http://www.eclipse.org/legal/epl-v10.html. 005// You must accept the terms of that agreement to use this software. 006// 007// Copyright (C) 2009-2011 Pentaho 008// All Rights Reserved. 009*/ 010package mondrian.olap.fun; 011 012import mondrian.calc.*; 013import mondrian.calc.impl.AbstractListCalc; 014import mondrian.mdx.ResolvedFunCall; 015import mondrian.olap.Evaluator; 016import mondrian.olap.Level; 017 018/** 019 * Definition of the <code><Level>.Members</code> MDX function. 020 * 021 * @author jhyde 022 * @since Jan 17, 2009 023 */ 024public class LevelMembersFunDef extends FunDefBase { 025 public static final LevelMembersFunDef INSTANCE = new LevelMembersFunDef(); 026 027 private LevelMembersFunDef() { 028 super("Members", "Returns the set of members in a level.", "pxl"); 029 } 030 031 public Calc compileCall(ResolvedFunCall call, ExpCompiler compiler) { 032 final LevelCalc levelCalc = 033 compiler.compileLevel(call.getArg(0)); 034 return new AbstractListCalc(call, new Calc[] {levelCalc}) { 035 public TupleList evaluateList(Evaluator evaluator) { 036 Level level = levelCalc.evaluateLevel(evaluator); 037 return levelMembers(level, evaluator, false); 038 } 039 }; 040 } 041} 042 043// End LevelMembersFunDef.java