/
Evaluator.java
86 lines (82 loc) · 2.46 KB
/
Evaluator.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
/*
// $Id$
// This software is subject to the terms of the Common Public License
// Agreement, available at the following URL:
// http://www.opensource.org/licenses/cpl.html.
// (C) Copyright 2001-2002 Kana Software, Inc. and others.
// All Rights Reserved.
// You must accept the terms of that agreement to use this software.
//
// jhyde, 27 July, 2001
*/
package mondrian.olap;
/**
* An <code>Evaluator</code> holds the context necessary to evaluate an
* expression.
*
* @author jhyde
* @since 27 July, 2001
* @version $Id$
**/
public interface Evaluator {
/** Returns the current cube. */
Cube getCube();
/** Creates a new evaluator with the same state. */
Evaluator push(Member[] members);
/** Creates a new evaluator with the same state.
* Equivalent to {@link #push(Member[]) push(new Member[0])}. **/
Evaluator push();
/** Creates a new evaluator with the same state except for one member.
* Equivalent to {@link #push(Member[]) push(new Member[]
* |member})}. **/
Evaluator push(Member member);
/** Restores previous evaluator. */
Evaluator pop();
/** Makes <code>member</code> the current member of its dimension. Returns
* the previous context. */
Member setContext(Member member);
void setContext(Member[] members);
Member getContext(Dimension dimension);
Object evaluateCurrent();
Object xx(Literal literal);
Object xx(FunCall funCall);
Object xx(Id id);
Object xx(OlapElement mdxElement);
Object xx(Parameter parameter);
String format(Object o);
/**
* Returns number of ancestor evaluators. Used to check for infinite
* loops.
*
* @post return getParent() == null ? 0 : getParent().getDepth() + 1
*/
int getDepth();
/**
* Returns parent evaluator.
*/
Evaluator getParent();
/**
* Retrieves the value of property <code>name</code>. If more than one
* member in the current context defines that property, the one with the
* highest solve order has precedence.
*/
Object getProperty(String name);
/**
* Returns a {@link SchemaReader} appropriate for the current access-control
* context.
*/
SchemaReader getSchemaReader();
/**
* Simple caching of the result of an <code>Exp</code>. The
* key for the cache consists of all members of the current
* context that <code>exp</code> depends on. Members of
* independent dimensions are not part of the key.
* @see Exp#dependsOn
*/
Object getExpResult(Exp key);
/**
* @see #getExpResult
*/
void setExpResult(Exp key, Object value);
}
// End Evaluator.java