001 /*
002 // $Id: //open/mondrian-release/3.1/src/main/mondrian/calc/impl/DimensionCurrentMemberCalc.java#2 $
003 // This software is subject to the terms of the Eclipse Public License v1.0
004 // Agreement, available at the following URL:
005 // http://www.eclipse.org/legal/epl-v10.html.
006 // Copyright (C) 2006-2006 Julian Hyde
007 // All Rights Reserved.
008 // You must accept the terms of that agreement to use this software.
009 */
010 package mondrian.calc.impl;
011
012 import mondrian.olap.*;
013 import mondrian.olap.type.MemberType;
014 import mondrian.calc.DummyExp;
015 import mondrian.calc.Calc;
016
017 /**
018 * Expression which returns the current member of a given dimension.
019 *
020 * @author jhyde
021 * @version $Id: //open/mondrian-release/3.1/src/main/mondrian/calc/impl/DimensionCurrentMemberCalc.java#2 $
022 * @since Sep 26, 2005
023 */
024 public class DimensionCurrentMemberCalc extends AbstractMemberCalc {
025 private final Dimension dimension;
026
027 public DimensionCurrentMemberCalc(Dimension dimension) {
028 super(
029 new DummyExp(
030 MemberType.forHierarchy(dimension.getHierarchy())),
031 new Calc[0]);
032 this.dimension = dimension;
033 }
034
035 public Member evaluateMember(Evaluator evaluator) {
036 return evaluator.getContext(dimension);
037 }
038
039 public boolean dependsOn(Dimension dimension) {
040 return dimension == this.dimension;
041 }
042 }
043
044 // End DimensionCurrentMemberCalc.java