001/*
002// This software is subject to the terms of the Eclipse Public License v1.0
003// Agreement, available at the following URL:
004// http://www.eclipse.org/legal/epl-v10.html.
005// You must accept the terms of that agreement to use this software.
006//
007// Copyright (C) 2002-2005 Julian Hyde
008// Copyright (C) 2005-2006 Pentaho and others
009// All Rights Reserved.
010*/
011package mondrian.olap.fun;
012
013import mondrian.olap.*;
014import mondrian.olap.type.Type;
015
016import java.io.PrintWriter;
017
018/**
019 * A <code>ValueFunDef</code> is a pseudo-function to evaluate a member or
020 * a tuple. Similar to {@link TupleFunDef}.
021 *
022 * @author jhyde
023 * @since Jun 14, 2002
024 */
025class ValueFunDef extends FunDefBase {
026    private final int[] argTypes;
027
028    ValueFunDef(int[] argTypes) {
029        super(
030            "_Value()",
031            "_Value([<Member>, ...])",
032            "Pseudo-function which evaluates a tuple.",
033            Syntax.Parentheses,
034            Category.Numeric,
035            argTypes);
036        this.argTypes = argTypes;
037    }
038
039    public int getReturnCategory() {
040        return Category.Tuple;
041    }
042
043    public int[] getParameterCategories() {
044        return argTypes;
045    }
046
047    public void unparse(Exp[] args, PrintWriter pw) {
048        ExpBase.unparseList(pw, args, "(", ", ", ")");
049    }
050
051    public Type getResultType(Validator validator, Exp[] args) {
052        return null;
053    }
054
055}
056
057// End ValueFunDef.java