Package mondrian.calc.impl

Examples of mondrian.calc.impl.AbstractMemberListCalc


        if ((depthSpecified || depthEmpty) && flag.leaves) {
            final IntegerCalc depthCalc =
                depthSpecified
                ? compiler.compileInteger(call.getArg(1))
                : null;
            return new AbstractMemberListCalc(
                call, new Calc[] {memberCalc, depthCalc})
            {
                public List<Member> evaluateMemberList(Evaluator evaluator) {
                    final Member member = memberCalc.evaluateMember(evaluator);
                    List<Member> result = new ArrayList<Member>();
                    int depth = -1;
                    if (depthCalc != null) {
                        depth = depthCalc.evaluateInteger(evaluator);
                        if (depth < 0) {
                            depth = -1; // no limit
                        }
                    }
                    final SchemaReader schemaReader =
                        evaluator.getSchemaReader();
                    descendantsLeavesByDepth(
                        member, result, schemaReader, depth);
                    hierarchizeMemberList(result, false);
                    return result;
                }
            };
        } else if (depthSpecified) {
            final IntegerCalc depthCalc =
                compiler.compileInteger(call.getArg(1));
            final Flag flag1 = flag;
            return new AbstractMemberListCalc(
                call, new Calc[] {memberCalc, depthCalc})
            {
                public List<Member> evaluateMemberList(Evaluator evaluator) {
                    final Member member = memberCalc.evaluateMember(evaluator);
                    List<Member> result = new ArrayList<Member>();
                    final int depth = depthCalc.evaluateInteger(evaluator);
                    final SchemaReader schemaReader =
                        evaluator.getSchemaReader();
                    descendantsByDepth(
                        member, result, schemaReader,
                        depth, flag1.before, flag1.self, flag1.after,
                        evaluator);
                    hierarchizeMemberList(result, false);
                    return result;
                }
            };
        } else {
            final LevelCalc levelCalc =
                call.getArgCount() > 1
                ? compiler.compileLevel(call.getArg(1))
                : null;
            final Flag flag2 = flag;
            return new AbstractMemberListCalc(
                call, new Calc[] {memberCalc, levelCalc})
            {
                public List<Member> evaluateMemberList(Evaluator evaluator) {
                    final Evaluator context =
                            evaluator.isNonEmpty() ? evaluator : null;
View Full Code Here


    }

    public Calc compileCall(ResolvedFunCall call, ExpCompiler compiler) {
        final LevelCalc levelCalc =
            compiler.compileLevel(call.getArg(0));
        return new AbstractMemberListCalc(call, new Calc[] {levelCalc}) {
            public List<Member> evaluateMemberList(Evaluator evaluator) {
                Level level = levelCalc.evaluateLevel(evaluator);
                return levelMembers(level, evaluator, false);
            }
        };
View Full Code Here

        String order = getLiteralArg(call, 1, "PRE", prePost);
        final boolean post = order.equals("POST");
        final int arity = ((SetType) listCalc.getType()).getArity();
        if (arity == 1) {
            final MemberListCalc memberListCalc = (MemberListCalc) listCalc;
            return new AbstractMemberListCalc(call, new Calc[] {listCalc}) {
                public List<Member> evaluateMemberList(Evaluator evaluator) {
                    List<Member> list =
                        memberListCalc.evaluateMemberList(evaluator);
                    hierarchizeMemberList(list, post);
                    return list;
View Full Code Here

TOP

Related Classes of mondrian.calc.impl.AbstractMemberListCalc

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.