Skip to content

Commit

Permalink
MONDRIAN:
Browse files Browse the repository at this point in the history
	* Remove vestiges of the old expression interpretation infrastrcture: remove Exp.evaluate(Evaluator), FunDef.evaluate(Evaluator,Exp[]).
	* Change UserDefinedFunction SPI so it is not dependent upon Exp.

[git-p4: depot-paths = "//open/mondrian/": change = 4961]
  • Loading branch information
julianhyde committed Jan 6, 2006
1 parent a0441d0 commit 130aa66
Show file tree
Hide file tree
Showing 41 changed files with 71 additions and 1,808 deletions.
7 changes: 0 additions & 7 deletions src/main/mondrian/calc/DummyExp.java
Expand Up @@ -53,13 +53,6 @@ public Calc accept(ExpCompiler compiler) {
throw new UnsupportedOperationException();
}

public Object evaluate(Evaluator evaluator) {
throw new UnsupportedOperationException();
}

public Object evaluateScalar(Evaluator evaluator) {
throw new UnsupportedOperationException();
}
}

// End DummyExp.java
5 changes: 0 additions & 5 deletions src/main/mondrian/mdx/DimensionExpr.java
Expand Up @@ -65,11 +65,6 @@ public Exp accept(Validator validator) {
return this;
}

public Object evaluate(Evaluator evaluator) {
Util.deprecated("remove Exp.evaluate");
return dimension;
}

public Calc accept(ExpCompiler compiler) {
return ConstantCalc.constantDimension(dimension);
}
Expand Down
4 changes: 0 additions & 4 deletions src/main/mondrian/mdx/HierarchyExpr.java
Expand Up @@ -65,10 +65,6 @@ public Exp accept(Validator validator) {
return this;
}

public Object evaluate(Evaluator evaluator) {
return hierarchy;
}

public Calc accept(ExpCompiler compiler) {
return ConstantCalc.constantHierarchy(hierarchy);
}
Expand Down
5 changes: 0 additions & 5 deletions src/main/mondrian/mdx/LevelExpr.java
Expand Up @@ -65,11 +65,6 @@ public Exp accept(Validator validator) {
return this;
}

public Object evaluate(Evaluator evaluator) {
Util.deprecated("remove Exp.evaluate");
return level;
}

public Calc accept(ExpCompiler compiler) {
return ConstantCalc.constantLevel(level);
}
Expand Down
5 changes: 0 additions & 5 deletions src/main/mondrian/mdx/MemberExpr.java
Expand Up @@ -65,11 +65,6 @@ public Exp accept(Validator validator) {
return this;
}

public Object evaluate(Evaluator evaluator) {
Util.deprecated("remove Exp.evaluate");
return member;
}

public Calc accept(ExpCompiler compiler) {
return ConstantCalc.constantMember(member);
}
Expand Down
7 changes: 0 additions & 7 deletions src/main/mondrian/mdx/NamedSetExpr.java
Expand Up @@ -86,13 +86,6 @@ public boolean dependsOn(Dimension dimension) {
};
}

public Object evaluate(Evaluator evaluator) {
Util.deprecated("remove Exp.evaluate");
final String name = namedSet.getName();
final Exp exp = namedSet.getExp();
return evaluator.evaluateNamedSet(name, exp);
}

public Type getType() {
return namedSet.getType();
}
Expand Down
8 changes: 0 additions & 8 deletions src/main/mondrian/mdx/UnresolvedFunCall.java
Expand Up @@ -90,14 +90,6 @@ public Calc accept(ExpCompiler compiler) {
throw new UnsupportedOperationException();
}

public Object evaluate(Evaluator evaluator) {
throw new UnsupportedOperationException();
}

public Object evaluateScalar(Evaluator evaluator) {
throw new UnsupportedOperationException();
}

/**
* Returns the function name.
*
Expand Down
34 changes: 2 additions & 32 deletions src/main/mondrian/olap/Evaluator.java
Expand Up @@ -71,39 +71,9 @@ public interface Evaluator {
Member getContext(Dimension dimension);

/**
* @see Util#deprecated(String)
*/
Object evaluateCurrent();

/**
* Visits a literal and returns its value.
*
* @see Util#deprecated(String)
*/
Object visit(Literal literal);

/**
* Visits a function call and returns its value.
*
* @see Util#deprecated(String)
*/
Object visit(FunCall funCall);

/**
* Visits an identifier and returns its value.
*/
Object visit(Id id);

/**
* Visits a catalog element, such as a dimension or member, and returns its
* value.
* Calculates and returns the value of the cell at the current context.
*/
Object visit(OlapElement mdxElement);

/**
* Visits a parameter and returns its value.
*/
Object visit(Parameter parameter);
Object evaluateCurrent();

/**
* Formats a value as a string according to the current context's
Expand Down
7 changes: 2 additions & 5 deletions src/main/mondrian/olap/Exp.java
Expand Up @@ -31,8 +31,9 @@ public interface Exp {

/**
* Returns the {@link Category} of the expression.
*
* @post Category.instance().isValid(return)
**/
*/
int getCategory();

/**
Expand Down Expand Up @@ -69,10 +70,6 @@ public interface Exp {
* @return A compiled expression
*/
Calc accept(ExpCompiler compiler);

Object evaluate(Evaluator evaluator);

Object evaluateScalar(Evaluator evaluator);
}

// End Exp.java
18 changes: 0 additions & 18 deletions src/main/mondrian/olap/ExpBase.java
Expand Up @@ -11,7 +11,6 @@
*/

package mondrian.olap;
import mondrian.olap.type.*;
import mondrian.calc.Calc;
import mondrian.calc.ExpCompiler;
import mondrian.mdx.MemberExpr;
Expand Down Expand Up @@ -69,23 +68,6 @@ public final Member[] isConstantTuple()
return members;
}

public Object evaluate(Evaluator evaluator) {
throw new Error("unsupported");
}

public Object evaluateScalar(Evaluator evaluator) {
Object o = evaluate(evaluator);
if (o instanceof Member) {
evaluator = evaluator.push((Member) o);
return evaluator.evaluateCurrent();
} else if (o instanceof Member[]) {
evaluator = evaluator.push((Member[]) o);
return evaluator.evaluateCurrent();
} else {
return o;
}
}

public static void unparseList(PrintWriter pw, Exp[] exps, String start,
String mid, String end) {
pw.print(start);
Expand Down
4 changes: 0 additions & 4 deletions src/main/mondrian/olap/FunCall.java
Expand Up @@ -123,10 +123,6 @@ public void unparse(PrintWriter pw) {
funDef.unparse(args, pw);
}

public Object evaluate(Evaluator evaluator) {
return evaluator.visit(this);
}

public Calc accept(ExpCompiler compiler) {
return funDef.compileCall(this, compiler);
}
Expand Down
5 changes: 0 additions & 5 deletions src/main/mondrian/olap/FunDef.java
Expand Up @@ -78,11 +78,6 @@ public interface FunDef {
*/
Calc compileCall(FunCall call, ExpCompiler compiler);

/**
* Applies this function to a set of arguments in the context provided
* by an evaluator, and returns the result.
*/
Object evaluate(Evaluator evaluator, Exp[] args);
}

// End FunDef.java
5 changes: 0 additions & 5 deletions src/main/mondrian/olap/Id.java
Expand Up @@ -107,11 +107,6 @@ public void unparse(PrintWriter pw) {
}
}

// implement Exp
public Object evaluate(Evaluator evaluator) {
return evaluator.visit(this);
}

}

// End Id.java
8 changes: 0 additions & 8 deletions src/main/mondrian/olap/Literal.java
Expand Up @@ -134,14 +134,6 @@ public Exp accept(Validator validator) {
return this;
}

public Object evaluate(Evaluator evaluator) {
return evaluator.visit(this);
}

public Object evaluateScalar(Evaluator evaluator) {
return o;
}

public Calc accept(ExpCompiler compiler) {
return new ConstantCalc(getType(), o);
}
Expand Down
3 changes: 0 additions & 3 deletions src/main/mondrian/olap/Parameter.java
Expand Up @@ -257,9 +257,6 @@ public boolean equals(Object other) {
that.exp.equals(this.exp);
}

public Object evaluate(Evaluator evaluator) {
return evaluator.visit(this);
}
}


Expand Down

0 comments on commit 130aa66

Please sign in to comment.