KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > mondrian > calc > impl > CacheCalc


1 /*
2 // $Id: //open/mondrian/src/main/mondrian/calc/impl/CacheCalc.java#2 $
3 // This software is subject to the terms of the Common Public License
4 // Agreement, available at the following URL:
5 // http://www.opensource.org/licenses/cpl.html.
6 // Copyright (C) 2006-2006 Julian Hyde
7 // All Rights Reserved.
8 // You must accept the terms of that agreement to use this software.
9 */

10 package mondrian.calc.impl;
11
12 import mondrian.olap.*;
13 import mondrian.calc.Calc;
14
15 /**
16  * Calculation which retrieves the value of an underlying calculation
17  * from cache.
18  *
19  * @author jhyde
20  * @version $Id: //open/mondrian/src/main/mondrian/calc/impl/CacheCalc.java#2 $
21  * @since Oct 10, 2005
22  */

23 public class CacheCalc extends GenericCalc {
24     private final ExpCacheDescriptor key;
25
26     public CacheCalc(Exp exp, ExpCacheDescriptor key) {
27         super(exp);
28         this.key = key;
29     }
30
31     public Object JavaDoc evaluate(Evaluator evaluator) {
32         return evaluator.getCachedResult(key);
33     }
34
35     public Calc[] getCalcs() {
36         return new Calc[] {key.getCalc()};
37     }
38 }
39
40 // End CacheCalc.java
41
Popular Tags