1 /* 2 // $Id: //open/mondrian/src/main/mondrian/olap/type/Type.java#4 $ 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) 2005-2006 Julian Hyde 7 // All Rights Reserved. 8 // You must accept the terms of that agreement to use this software. 9 */ 10 package mondrian.olap.type; 11 12 import mondrian.olap.Dimension; 13 import mondrian.olap.Hierarchy; 14 import mondrian.olap.Level; 15 16 /** 17 * Type of an MDX expression. 18 * 19 * @author jhyde 20 * @since Feb 17, 2005 21 * @version $Id: //open/mondrian/src/main/mondrian/olap/type/Type.java#4 $ 22 */ 23 public interface Type { 24 /** 25 * Returns whether this type contains a given dimension.<p/> 26 * 27 * For example: 28 * <ul> 29 * <li><code>DimensionType([Gender])</code> uses only the 30 * <code>[Gender]</code> dimension.</li> 31 * <li><code>TupleType(MemberType([Gender]), MemberType([Store]))</code> 32 * uses <code>[Gender]</code> and <code>[Store]</code> 33 * dimensions.</li> 34 * </ul><p/> 35 * 36 * The <code>maybe</code> parameter comes into play when the 37 * dimensional information is incomplete. For example, when applied to 38 * <code>TupleType(MemberType(null), MemberType([Store]))</code>, 39 * <code>usesDimension([Gender], false)</code> returns true because it 40 * is possible that the expression returns a member of the 41 * <code>[Gender]</code> dimension. 42 * 43 * @param dimension Dimension 44 * @param maybe If true, returns true only if this type definitely 45 * uses the dimension 46 */ 47 boolean usesDimension(Dimension dimension, boolean maybe); 48 49 /** 50 * Returns the dimension of this type, or null if not known. 51 */ 52 Dimension getDimension(); 53 54 /** 55 * Returns the hierarchy of this type. If not applicable, throws. 56 */ 57 Hierarchy getHierarchy(); 58 59 /** 60 * Returns the level of this type, or null if not known. 61 */ 62 Level getLevel(); 63 64 } 65 66 // End Type.java 67