001    /*
002    // $Id: //open/mondrian/src/main/mondrian/olap/LevelType.java#10 $
003    // This software is subject to the terms of the Common Public License
004    // Agreement, available at the following URL:
005    // http://www.opensource.org/licenses/cpl.html.
006    // Copyright (C) 2004-2006 Julian Hyde
007    // All Rights Reserved.
008    // You must accept the terms of that agreement to use this software.
009    */
010    package mondrian.olap;
011    
012    
013    
014    /**
015     * Enumerates the types of levels.
016     *
017     * @author jhyde
018     * @since 5 April, 2004
019     * @version $Id: //open/mondrian/src/main/mondrian/olap/LevelType.java#10 $
020     */
021    public enum LevelType {
022    
023        /** Indicates that the level is not related to time. */
024        Regular,
025    
026        /**
027         * Indicates that a level refers to years.
028         * It must be used in a dimension whose type is
029         * {@link DimensionType#TimeDimension}.
030         */
031        TimeYears,
032    
033        /**
034         * Indicates that a level refers to quarters.
035         * It must be used in a dimension whose type is
036         * {@link DimensionType#TimeDimension}.
037         */
038        TimeQuarters,
039    
040        /**
041         * Indicates that a level refers to months.
042         * It must be used in a dimension whose type is
043         * {@link DimensionType#TimeDimension}.
044         */
045        TimeMonths,
046    
047        /**
048         * Indicates that a level refers to weeks.
049         * It must be used in a dimension whose type is
050         * {@link DimensionType#TimeDimension}.
051         */
052        TimeWeeks,
053    
054        /**
055         * Indicates that a level refers to days.
056         * It must be used in a dimension whose type is
057         * {@link DimensionType#TimeDimension}.
058         */
059        TimeDays,
060    
061        /**
062         * Indicates that a level holds the null member.
063         */
064        Null;
065    
066        public boolean isTime() {
067            return ordinal() >= TimeYears.ordinal() &&
068                ordinal() <= TimeDays.ordinal();
069        }
070    }
071    
072    // End LevelType.java