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) 2000-2005 Julian Hyde
008// Copyright (C) 2005-2006 Pentaho and others
009// All Rights Reserved.
010*/
011package mondrian.olap;
012
013import mondrian.olap.type.Type;
014
015/**
016 * A named set of members or tuples.
017 *
018 * <p>A set can be defined in a query, using a <code>WITH SET</code> clause,
019 * or in a schema. Named sets in a schema can be defined against a particular
020 * cube or virtual cube, or shared between all cubes.</p>
021 *
022 * @author jhyde
023 * @since 6 August, 2001
024 */
025public interface NamedSet extends OlapElement, Annotated {
026    /**
027     * Sets the name of this named set.
028     */
029    void setName(String newName);
030
031    /**
032     * Returns the type of this named set.
033     */
034    Type getType();
035
036    /**
037     * Returns the expression used to derive this named set.
038     */
039    Exp getExp();
040
041    NamedSet validate(Validator validator);
042
043    /**
044     * Returns a name for this set that is unique within the query.
045     *
046     * <p>This is necessary when there are several 'AS' expressions, or an 'AS'
047     * expression overrides a named set defined using 'WITH MEMBER' clause or
048     * against a cube.
049     */
050    String getNameUniqueWithinQuery();
051
052    /**
053     * Returns whether this named set is dynamic.
054     *
055     * <p>Evaluation rules:
056     * <ul>
057     * <li>A dynamic set is evaluated each time it is used, and inherits the
058     *     context in which it is evaluated.
059     * <li>A static set is evaluated only on first use, in the base context of
060     *     the cube.
061     * </ul>
062     *
063     * @return Whether this named set is dynamic
064     */
065    boolean isDynamic();
066}
067
068// End NamedSet.java