001 /* 002 // $Id: //open/mondrian/src/main/mondrian/calc/impl/CacheCalc.java#2 $ 003 // This software is subject to the terms of the Common Public License 004 // Agreement, available at the following URL: 005 // http://www.opensource.org/licenses/cpl.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.calc.Calc; 014 015 /** 016 * Calculation which retrieves the value of an underlying calculation 017 * from cache. 018 * 019 * @author jhyde 020 * @version $Id: //open/mondrian/src/main/mondrian/calc/impl/CacheCalc.java#2 $ 021 * @since Oct 10, 2005 022 */ 023 public class CacheCalc extends GenericCalc { 024 private final ExpCacheDescriptor key; 025 026 public CacheCalc(Exp exp, ExpCacheDescriptor key) { 027 super(exp); 028 this.key = key; 029 } 030 031 public Object evaluate(Evaluator evaluator) { 032 return evaluator.getCachedResult(key); 033 } 034 035 public Calc[] getCalcs() { 036 return new Calc[] {key.getCalc()}; 037 } 038 } 039 040 // End CacheCalc.java