001 /* 002 // $Id: Position.java 482 2012-01-05 23:27:27Z jhyde $ 003 // 004 // Licensed to Julian Hyde under one or more contributor license 005 // agreements. See the NOTICE file distributed with this work for 006 // additional information regarding copyright ownership. 007 // 008 // Julian Hyde licenses this file to you under the Apache License, 009 // Version 2.0 (the "License"); you may not use this file except in 010 // compliance with the License. You may obtain a copy of the License at: 011 // 012 // http://www.apache.org/licenses/LICENSE-2.0 013 // 014 // Unless required by applicable law or agreed to in writing, software 015 // distributed under the License is distributed on an "AS IS" BASIS, 016 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 017 // See the License for the specific language governing permissions and 018 // limitations under the License. 019 */ 020 package org.olap4j; 021 022 import org.olap4j.metadata.Member; 023 024 import java.util.List; 025 026 /** 027 * Position on one of the {@link CellSetAxis} objects in a {@link CellSet}. 028 * 029 * <p>An axis has a particular dimensionality, that is, a set of one or more 030 * dimensions which will appear on that axis, and every position on that axis 031 * will have a member of each of those dimensions. For example, in the MDX 032 * query</p> 033 * 034 * <blockquote> 035 * <code>SELECT {[Measures].[Unit Sales], [Measures].[Store Sales]} ON 036 * COLUMNS,<br> 037 * CrossJoin(<br> 038 * {[Gender].Members},<br> 039 * {[Product].[Food], 040 * [Product].[Drink]}) ON ROWS<br> 041 * FROM [Sales]</code> 042 * </blockquote> 043 * 044 * <p>the <code>COLUMNS</code> axis has dimensionality 045 * {<code>[Measures]</code>} and the <code>ROWS</code> axis has dimensionality 046 * {<code>[Gender]</code>, <code>[Product]</code>}. In the result,</p> 047 * 048 * <table border="1" id="table1" cellpadding="3"> 049 * <tr> 050 * <td bgcolor="#E0E0E0"><b><i>Gender</i></b></td> 051 * <td bgcolor="#E0E0E0"><b><i>Product</i></b></td> 052 * <td bgcolor="#E0E0E0"><b>Unit Sales</b></td> 053 * <td bgcolor="#E0E0E0"><b>Store Sales</b></td> 054 * </tr> 055 * <tr> 056 * <td bgcolor="#E0E0E0"><b>All Gender</b></td> 057 * <td bgcolor="#E0E0E0"><b>Food</b></td> 058 * <td align="right">191,940</td> 059 * <td align="right">409,035.59</td> 060 * </tr> 061 * <tr> 062 * <td bgcolor="#E0E0E0"><b>All Gender</b></td> 063 * <td bgcolor="#E0E0E0"><b>Drink</b></td> 064 * <td align="right">24,597</td> 065 * <td align="right">48,836.21</td> 066 * </tr> 067 * <tr> 068 * <td bgcolor="#E0E0E0"><b>F</b></td> 069 * <td bgcolor="#E0E0E0"><b>Food</b></td> 070 * <td align="right">94,814</td> 071 * <td align="right">203,094.17</td> 072 * </tr> 073 * <tr> 074 * <td bgcolor="#E0E0E0"><b>F</b></td> 075 * <td bgcolor="#E0E0E0"><b>Drink</b></td> 076 * <td align="right">12,202</td> 077 * <td align="right">24,457.37</td> 078 * </tr> 079 * <tr> 080 * <td bgcolor="#E0E0E0"><b>M</b></td> 081 * <td bgcolor="#E0E0E0"><b>Food</b></td> 082 * <td align="right">97,126</td> 083 * <td align="right">205,941.42</td> 084 * </tr> 085 * <tr> 086 * <td bgcolor="#E0E0E0"><b>M</b></td> 087 * <td bgcolor="#E0E0E0"><b>Drink</b></td> 088 * <td align="right">12,395</td> 089 * <td align="right">24,378.84</td> 090 * </tr> 091 * </table> 092 * 093 * <p>each of the six positions on the <code>ROWS</code> axis has two members, 094 * consistent with its dimensionality of 2. The <code>COLUMNS</code> axis has 095 * two positions, each with one member.</p> 096 * 097 * @author jhyde 098 * @version $Id: Position.java 482 2012-01-05 23:27:27Z jhyde $ 099 * @since Aug 22, 2006 100 */ 101 public interface Position { 102 /** 103 * Returns the list of Member objects at this position. 104 * 105 * <p>Recall that the {@link CellSetAxisMetaData#getHierarchies()} 106 * method describes the hierarchies which occur on an axis. The positions on 107 * that axis must conform. Suppose that the ROWS axis of a given statement 108 * returns <code>{[Gender], [Store]}</code>. Then every Position on 109 * that axis will have two members: the first a member of the [Gender] 110 * dimension, the second a member of the [Store] dimension.</p> 111 * 112 * @return A list of Member objects at this Position. 113 */ 114 public List<Member> getMembers(); 115 116 /** 117 * Returns the zero-based ordinal of this Position on its 118 * {@link CellSetAxis}. 119 * 120 * @return ordinal of this Position 121 */ 122 int getOrdinal(); 123 } 124 125 // End Position.java