001    /*
002    // $Id: //open/mondrian-release/3.2/src/main/mondrian/olap/NamedSet.java#1 $
003    // This software is subject to the terms of the Eclipse Public License v1.0
004    // Agreement, available at the following URL:
005    // http://www.eclipse.org/legal/epl-v10.html.
006    // Copyright (C) 2000-2002 Kana Software, Inc.
007    // Copyright (C) 2001-2006 Julian Hyde and others
008    // All Rights Reserved.
009    // You must accept the terms of that agreement to use this software.
010    */
011    
012    package mondrian.olap;
013    
014    import mondrian.olap.type.Type;
015    
016    /**
017     * A named set of members or tuples.
018     *
019     * <p>A set can be defined in a query, using a <code>WITH SET</code> clause,
020     * or in a schema. Named sets in a schema can be defined against a particular
021     * cube or virtual cube, or shared between all cubes.</p>
022     *
023     * @author jhyde
024     * @since 6 August, 2001
025     * @version $Id: //open/mondrian-release/3.2/src/main/mondrian/olap/NamedSet.java#1 $
026     */
027    public interface NamedSet extends OlapElement, Annotated {
028        /**
029         * Sets the name of this named set.
030         */
031        void setName(String newName);
032    
033        /**
034         * Returns the type of this named set.
035         */
036        Type getType();
037    
038        /**
039         * Returns the expression used to derive this named set.
040         */
041        Exp getExp();
042    
043        NamedSet validate(Validator validator);
044    
045        /**
046         * Returns a name for this set that is unique within the query.
047         *
048         * <p>This is necessary when there are several 'AS' expressions, or an 'AS'
049         * expression overrides a named set defined using 'WITH MEMBER' clause or
050         * against a cube.
051         */
052        String getNameUniqueWithinQuery();
053    
054        /**
055         * Returns whether this named set is dynamic.
056         *
057         * <p>Evaluation rules:
058         * <ul>
059         * <li>A dynamic set is evaluated each time it is used, and inherits the
060         *     context in which it is evaluated.
061         * <li>A static set is evaluated only on first use, in the base context of
062         *     the cube.
063         * </ul>
064         *
065         * @return Whether this named set is dynamic
066         */
067        boolean isDynamic();
068    }
069    
070    // End NamedSet.java