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