KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > mondrian > olap > AxisOrdinal


1 /*
2 // $Id: //open/mondrian/src/main/mondrian/olap/AxisOrdinal.java#9 $
3 // This software is subject to the terms of the Common Public License
4 // Agreement, available at the following URL:
5 // http://www.opensource.org/licenses/cpl.html.
6 // Copyright (C) 2003-2007 Julian Hyde
7 // All Rights Reserved.
8 // You must accept the terms of that agreement to use this software.
9 //
10 // jhyde, Feb 21, 2003
11 */

12 package mondrian.olap;
13
14 /**
15  * <code>AxisOrdinal</code> describes the allowable values for an axis code.
16  *
17  * @author jhyde
18  * @since Feb 21, 2003
19  * @version $Id: //open/mondrian/src/main/mondrian/olap/AxisOrdinal.java#9 $
20  */

21 public enum AxisOrdinal {
22
23     /** No axis.*/
24     NONE,
25
26     /** Slicer axis. */
27     SLICER,
28
29     /** Columns axis (also known as X axis), logical ordinal = 0. */
30     COLUMNS,
31
32     /** Rows axis (also known as Y axis), logical ordinal = 1. */
33     ROWS,
34
35     /** Pages axis, logical ordinal = 2. */
36     PAGES,
37
38     /** Chapters axis, logical ordinal = 3. */
39     CHAPTERS,
40
41     /** Sections axis, logical ordinal = 4. */
42     SECTIONS;
43
44     public static AxisOrdinal forLogicalOrdinal(int ordinal) {
45         return values()[ordinal + 2];
46     }
47
48     /**
49      * Returns the ordinal of this axis with {@link #COLUMNS} = 0,
50      * {@link #ROWS} = 1, etc.
51      */

52     public int logicalOrdinal() {
53         return ordinal() - 2;
54     }
55
56     public static final int MaxLogicalOrdinal = SECTIONS.logicalOrdinal() + 1;
57 }
58
59 // End AxisOrdinal.java
Popular Tags