001 /*
002 // $Id: Position.java 229 2009-05-08 19:11:29Z jhyde $
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) 2006-2008 Julian Hyde
007 // All Rights Reserved.
008 // You must accept the terms of that agreement to use this software.
009 */
010 package org.olap4j;
011
012 import org.olap4j.metadata.Member;
013
014 import java.util.List;
015
016 /**
017 * Position on one of the {@link CellSetAxis} objects in a {@link CellSet}.
018 *
019 * <p>An axis has a particular dimensionality, that is, a set of one or more
020 * dimensions which will appear on that axis, and every position on that axis
021 * will have a member of each of those dimensions. For example, in the MDX
022 * query</p>
023 *
024 * <blockquote>
025 * <code>SELECT {[Measures].[Unit Sales], [Measures].[Store Sales]} ON
026 * COLUMNS,<br>
027 * CrossJoin(<br>
028 * {[Gender].Members},<br>
029 * {[Product].[Food],
030 * [Product].[Drink]}) ON ROWS<br>
031 * FROM [Sales]</code>
032 * </blockquote>
033 *
034 * <p>the <code>COLUMNS</code> axis has dimensionality
035 * {<code>[Measures]</code>} and the <code>ROWS</code> axis has dimensionality
036 * {<code>[Gender]</code>, <code>[Product]</code>}. In the result,</p>
037 *
038 * <table border="1" id="table1" cellpadding="3">
039 * <tr>
040 * <td bgcolor="#E0E0E0"><b><i>Gender</i></b></td>
041 * <td bgcolor="#E0E0E0"><b><i>Product</i></b></td>
042 * <td bgcolor="#E0E0E0"><b>Unit Sales</b></td>
043 * <td bgcolor="#E0E0E0"><b>Store Sales</b></td>
044 * </tr>
045 * <tr>
046 * <td bgcolor="#E0E0E0"><b>All Gender</b></td>
047 * <td bgcolor="#E0E0E0"><b>Food</b></td>
048 * <td align="right">191,940</td>
049 * <td align="right">409,035.59</td>
050 * </tr>
051 * <tr>
052 * <td bgcolor="#E0E0E0"><b>All Gender</b></td>
053 * <td bgcolor="#E0E0E0"><b>Drink</b></td>
054 * <td align="right">24,597</td>
055 * <td align="right">48,836.21</td>
056 * </tr>
057 * <tr>
058 * <td bgcolor="#E0E0E0"><b>F</b></td>
059 * <td bgcolor="#E0E0E0"><b>Food</b></td>
060 * <td align="right">94,814</td>
061 * <td align="right">203,094.17</td>
062 * </tr>
063 * <tr>
064 * <td bgcolor="#E0E0E0"><b>F</b></td>
065 * <td bgcolor="#E0E0E0"><b>Drink</b></td>
066 * <td align="right">12,202</td>
067 * <td align="right">24,457.37</td>
068 * </tr>
069 * <tr>
070 * <td bgcolor="#E0E0E0"><b>M</b></td>
071 * <td bgcolor="#E0E0E0"><b>Food</b></td>
072 * <td align="right">97,126</td>
073 * <td align="right">205,941.42</td>
074 * </tr>
075 * <tr>
076 * <td bgcolor="#E0E0E0"><b>M</b></td>
077 * <td bgcolor="#E0E0E0"><b>Drink</b></td>
078 * <td align="right">12,395</td>
079 * <td align="right">24,378.84</td>
080 * </tr>
081 * </table>
082 *
083 * <p>each of the six positions on the <code>ROWS</code> axis has two members,
084 * consistent with its dimensionality of 2. The <code>COLUMNS</code> axis has
085 * two positions, each with one member.</p>
086 *
087 * @author jhyde
088 * @version $Id: Position.java 229 2009-05-08 19:11:29Z jhyde $
089 * @since Aug 22, 2006
090 */
091 public interface Position {
092 /**
093 * Returns the list of Member objects at this position.
094 *
095 * <p>Recall that the {@link CellSetAxisMetaData#getHierarchies()}
096 * method describes the hierarchies which occur on an axis. The positions on
097 * that axis must conform. Suppose that the ROWS axis of a given statement
098 * returns <code>{[Gender], [Store]}</code>. Then every Position on
099 * that axis will have two members: the first a member of the [Gender]
100 * dimension, the second a member of the [Store] dimension.</p>
101 *
102 * @return A list of Member objects at this Position.
103 */
104 public List<Member> getMembers();
105
106 /**
107 * Returns the zero-based ordinal of this Position on its
108 * {@link CellSetAxis}.
109 *
110 * @return ordinal of this Position
111 */
112 int getOrdinal();
113 }
114
115 // End Position.java