001 /*
002 // $Id: //open/mondrian-release/3.0/src/main/mondrian/olap/AxisOrdinal.java#2 $
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) 2003-2007 Julian Hyde
007 // All Rights Reserved.
008 // You must accept the terms of that agreement to use this software.
009 //
010 // jhyde, Feb 21, 2003
011 */
012 package mondrian.olap;
013
014 /**
015 * <code>AxisOrdinal</code> describes the allowable values for an axis code.
016 *
017 * @author jhyde
018 * @since Feb 21, 2003
019 * @version $Id: //open/mondrian-release/3.0/src/main/mondrian/olap/AxisOrdinal.java#2 $
020 */
021 public enum AxisOrdinal {
022
023 /** No axis.*/
024 NONE,
025
026 /** Slicer axis. */
027 SLICER,
028
029 /** Columns axis (also known as X axis), logical ordinal = 0. */
030 COLUMNS,
031
032 /** Rows axis (also known as Y axis), logical ordinal = 1. */
033 ROWS,
034
035 /** Pages axis, logical ordinal = 2. */
036 PAGES,
037
038 /** Chapters axis, logical ordinal = 3. */
039 CHAPTERS,
040
041 /** Sections axis, logical ordinal = 4. */
042 SECTIONS;
043
044 public static AxisOrdinal forLogicalOrdinal(int ordinal) {
045 return values()[ordinal + 2];
046 }
047
048 /**
049 * Returns the ordinal of this axis with {@link #COLUMNS} = 0,
050 * {@link #ROWS} = 1, etc.
051 */
052 public int logicalOrdinal() {
053 return ordinal() - 2;
054 }
055
056 public static final int MaxLogicalOrdinal = SECTIONS.logicalOrdinal() + 1;
057 }
058
059 // End AxisOrdinal.java