/** * {@inheritDoc} * * Uses the current ResultStyle to compile the expression. */ public Calc compile(Exp exp) { return exp.accept(this); }
protected static Exp[] cloneArray(Exp[] a) { Exp[] a2 = new Exp[a.length]; for (int i = 0; i < a.length; i++) { a2[i] = a[i].clone(); } return a2; }
public static int[] getTypes(Exp[] exps) { int[] types = new int[exps.length]; for (int i = 0; i < exps.length; i++) { types[i] = exps[i].getCategory(); } return types; }
public FunDef resolve( Exp[] args, Validator validator, List<Conversion> conversions) { if (args.length != 1) { return null; } final Exp exp = args[0]; final int category = exp.getCategory(); final Type type = exp.getType(); return new CacheFunDef( NAME, SIGNATURE, DESCRIPTION, SYNTAX, category, type); }
public NamedSet validate(Validator validator) { Exp newExpr = expr.accept(validator); final Type type = newExpr.getType(); if (type instanceof MemberType || type instanceof TupleType) { newExpr = new UnresolvedFunCall( "{}", Syntax.Braces, new Exp[] {newExpr}) .accept(validator); } this.expr = newExpr; return this; }
/** * Creates an AbstractCalc. * * @param exp Source expression * @param calcs Child compiled expressions */ protected AbstractCalc(Exp exp, Calc[] calcs) { assert exp != null; this.exp = exp; this.calcs = calcs; this.type = exp.getType(); }
public void unparse(Exp[] args, PrintWriter pw) { args[0].unparse(pw); }
|| MondrianProperties.instance().ReadAggregates.get()) return funArg.accept(compiler); assert arity >= 0; if (arity == 1 || substitutionMap.isEmpty()) { IterCalc calc = (IterCalc) funArg.accept(compiler); final boolean highCardinality = arity == 1 originalExp = funArg.clone(); Query query = compiler.getEvaluator().getQuery(); call.accept(
public Type getType() { return expr.getType(); }
public Calc compileCall(ResolvedFunCall call, ExpCompiler compiler) { final Exp[] args = call.getArgs(); if (args.length == 0) { // Special treatment for empty set, because we don't know whether it // is a set of members or tuples, and so we need it to implement // both MemberListCalc and ListCalc. return new EmptyListCalc(call); } if (args.length == 1 && args[0].getType() instanceof SetType) { // Optimized case when there is only one argument. This occurs quite // often, because people write '{Foo.Children} on 1' when they could // write 'Foo.Children on 1'. return args[0].accept(compiler); } return new SetListCalc( call, args, compiler, ResultStyle.LIST_MUTABLELIST); }
public void unparse(PrintWriter pw) { e.unparse(pw); }
/** * Creates a call to the set operator with a given collection of * expressions. * * <p>There must be at least one expression. Each expression may be a set of * members/tuples, or may be a member/tuple, but method assumes that * expressions have compatible types. * * @param args Expressions * @return Call to set operator */ public static ResolvedFunCall wrapAsSet(Exp... args) { assert args.length > 0; final int[] categories = new int[args.length]; Type type = null; for (int i = 0; i < args.length; i++) { final Exp arg = args[i]; categories[i] = arg.getCategory(); final Type argType = arg.getType(); if (argType instanceof SetType) { type = ((SetType) argType).getElementType(); } else { type = argType; } } return new ResolvedFunCall( new SetFunDef(Resolver, categories), args, new SetType(type)); }
public Type getResultType(Validator validator, Exp[] args) { return args[0].getType(); }
public Object accept(MdxVisitor visitor) { return e.accept(visitor); } }
public void unparse(PrintWriter pw) { pw.print(name + " = "); exp.unparse(pw); }
public int getCategory() { return e.getCategory(); }
Exp typeArg = args[1]; int category; Type type = typeArg.getType(); switch (typeArg.getCategory()) { case Category.Dimension: case Category.Hierarchy: + "' is inconsistent with its type, " + typeName); if (exp.getCategory() == Category.Set && category == Category.Member) Type expType = exp.getType(); if (expType instanceof SetType) { expType = ((SetType) expType).getElementType(); if (args.length > 3) { if (args[3] instanceof Literal && args[3].getCategory() == Category.String)
public Object clone() { return new SetBase( name, caption, description, exp.clone(), validated, annotationMap); }
public Type getType() { return e.getType(); }