001 /* 002 // $Id: //open/mondrian/src/main/mondrian/olap/Member.java#25 $ 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) 1999-2002 Kana Software, Inc. 007 // Copyright (C) 2001-2008 Julian Hyde and others 008 // All Rights Reserved. 009 // You must accept the terms of that agreement to use this software. 010 // 011 // jhyde, 2 March, 1999 012 */ 013 014 package mondrian.olap; 015 016 import java.util.List; 017 018 /** 019 * A <code>Member</code> is a 'point' on a dimension of a cube. Examples are 020 * <code>[Time].[1997].[January]</code>, 021 * <code>[Customer].[All Customers]</code>, 022 * <code>[Customer].[USA].[CA]</code>, 023 * <code>[Measures].[Unit Sales]</code>. 024 * 025 * <p> Every member belongs to a {@link Level} of a {@link Hierarchy}. Members 026 * except the root member have a parent, and members not at the leaf level 027 * have one or more children. 028 * 029 * <p> Measures are a special kind of member. They belong to their own 030 * dimension, <code>[Measures]</code>. 031 * 032 * <p> There are also special members representing the 'All' value of a 033 * hierarchy, the null value, and the error value. 034 * 035 * <p> Members can have member properties. Their {@link Level#getProperties} 036 * defines which are allowed. 037 */ 038 public interface Member extends OlapElement, Comparable { 039 040 /** 041 * Returns this member's parent, or null (not the 'null member', as 042 * returned by {@link Hierarchy#getNullMember}) if it has no parent. 043 * 044 * <p>In an access-control context, a member may have no <em>visible</em> 045 * parents, so use {@link SchemaReader#getMemberParent}. 046 */ 047 Member getParentMember(); 048 049 Level getLevel(); 050 051 Hierarchy getHierarchy(); 052 053 /** 054 * Returns name of parent member, or empty string (not null) if we are the 055 * root. 056 */ 057 String getParentUniqueName(); 058 059 /** 060 * Returns the type of member. 061 */ 062 MemberType getMemberType(); 063 064 enum MemberType { 065 UNKNOWN, 066 REGULAR, // adMemberRegular 067 ALL, 068 MEASURE, 069 FORMULA, 070 /** 071 * This member is its hierarchy's NULL member (such as is returned by 072 * <code>[Gender].[All Gender].PrevMember</code>, for example). 073 */ 074 NULL 075 } 076 077 /** 078 * Only allowable if the member is part of the <code>WITH</code> clause of 079 * a query. 080 */ 081 void setName(String name); 082 083 /** Returns whether this is the 'all' member. */ 084 boolean isAll(); 085 086 /** Returns whether this is a member of the measures dimension. */ 087 boolean isMeasure(); 088 089 /** Returns whether this is the 'null member'. */ 090 boolean isNull(); 091 092 /** 093 * Returns whether <code>member</code> is equal to, a child, or a 094 * descendent of this <code>Member</code>. 095 */ 096 boolean isChildOrEqualTo(Member member); 097 098 /** Returns whether this member is computed using either a <code>with 099 * member</code> clause in an mdx query or a calculated member defined in 100 * cube. */ 101 boolean isCalculated(); 102 int getSolveOrder(); 103 Exp getExpression(); 104 105 /** 106 * Returns a list of the ancestor members of this member. 107 */ 108 List<Member> getAncestorMembers(); 109 110 /** 111 * Returns whether this member is computed from a {@code WITH MEMBER} 112 * clause in an MDX query. 113 */ 114 boolean isCalculatedInQuery(); 115 116 /** 117 * Returns the value of the property named <code>propertyName</code>. 118 * Name match is case-sensitive. 119 */ 120 Object getPropertyValue(String propertyName); 121 122 /** 123 * Returns the value of the property named <code>propertyName</code>, 124 * matching according to the required case-sensitivity. 125 */ 126 Object getPropertyValue(String propertyName, boolean matchCase); 127 128 /** 129 * Returns the formatted value of the property named <code>propertyName</code>. 130 */ 131 String getPropertyFormattedValue(String propertyName); 132 133 /** 134 * Sets a property of this member to a given value. 135 */ 136 void setProperty(String name, Object value); 137 138 /** 139 * Returns the definitions of the properties this member may have. 140 */ 141 Property[] getProperties(); 142 143 /** 144 * Returns the ordinal of the member. 145 */ 146 int getOrdinal(); 147 148 /** 149 * Returns the order key of the member (relative to its siblings); 150 * null if undefined or unavailable. 151 */ 152 Comparable getOrderKey(); 153 154 /** 155 * Returns whether this member is 'hidden', as per the rules which define 156 * a ragged hierarchy. 157 */ 158 boolean isHidden(); 159 160 /** 161 * returns the depth of this member, which is not the level's depth 162 * in case of parent child dimensions 163 * @return depth 164 */ 165 int getDepth(); 166 167 /** 168 * Returns the system-generated data member that is associated with a 169 * nonleaf member of a dimension. 170 * 171 * <p>Returns this member if this member is a leaf member, or if the 172 * nonleaf member does not have an associated data member.</p> 173 */ 174 Member getDataMember(); 175 } 176 177 // End Member.java