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) 2006-2006 Pentaho 008// All Rights Reserved. 009*/ 010package mondrian.calc.impl; 011 012import mondrian.calc.Calc; 013import mondrian.olap.*; 014 015/** 016 * Calculation which retrieves the value of an underlying calculation 017 * from cache. 018 * 019 * @author jhyde 020 * @since Oct 10, 2005 021 */ 022public class CacheCalc extends GenericCalc { 023 private final ExpCacheDescriptor key; 024 025 public CacheCalc(Exp exp, ExpCacheDescriptor key) { 026 super(exp); 027 this.key = key; 028 } 029 030 public Object evaluate(Evaluator evaluator) { 031 return evaluator.getCachedResult(key); 032 } 033 034 public Calc[] getCalcs() { 035 return new Calc[] {key.getCalc()}; 036 } 037} 038 039// End CacheCalc.java