mondrian.olap
Class MemberBase

java.lang.Object
  extended by mondrian.olap.OlapElementBase
      extended by mondrian.olap.MemberBase
All Implemented Interfaces:
Comparable, Member, OlapElement
Direct Known Subclasses:
RolapMember

public abstract class MemberBase
extends OlapElementBase
implements Member

MemberBase is a partial implementation of Member.

Since:
6 August, 2001
Version:
$Id: //open/mondrian-release/3.0/src/main/mondrian/olap/MemberBase.java#3 $
Author:
jhyde

Nested Class Summary
 
Nested classes/interfaces inherited from interface mondrian.olap.Member
Member.MemberType
 
Field Summary
protected  int flags
          Combines member type and other properties, such as whether the member is the 'all' or 'null' member of its hierarchy and whether it is a measure or is calculated, into an integer field.
protected  Level level
           
protected  Member parentMember
           
protected  String parentUniqueName
           
protected  String uniqueName
           
 
Fields inherited from class mondrian.olap.OlapElementBase
caption
 
Constructor Summary
protected MemberBase()
           
protected MemberBase(Member parentMember, Level level, Member.MemberType memberType)
           
 
Method Summary
protected  boolean computeCalculated(Member.MemberType memberType)
          Computes the value to be returned by isCalculated(), so it can be cached in a variable.
 Member[] getAncestorMembers()
          Returns array of all members, which are ancestor to this.
 String getCaption()
          Returns the display name of this catalog element.
 Member getDataMember()
          Returns the system-generated data member that is associated with a nonleaf member of a dimension.
 String getDescription()
           
 Dimension getDimension()
          Returns the dimension of a this expression, or null if no dimension is defined.
 Exp getExpression()
          Returns the expression by which this member is calculated.
 Hierarchy getHierarchy()
           
 Level getLevel()
           
 Member.MemberType getMemberType()
          Returns the type of member.
abstract  String getName()
           
 Comparable getOrderKey()
          Returns the order key of this member among its siblings.
 int getOrdinal()
          Returns the ordinal of this member within its hierarchy.
 Member getParentMember()
          Returns this member's parent, or null (not the 'null member', as returned by Hierarchy.getNullMember()) if it has no parent.
 String getParentUniqueName()
          Returns name of parent member, or empty string (not null) if we are the root.
 String getPropertyFormattedValue(String propertyName)
          Returns the formatted value of the property named propertyName.
 String getQualifiedName()
          Returns the name of this element qualified by its class, for example "hierarchy 'Customers'".
 int getSolveOrder()
           
 String getUniqueName()
           
 boolean isAll()
          Returns whether this is the 'all' member.
 boolean isCalculated()
          Returns whether this member is computed using either a with member clause in an mdx query or a calculated member defined in cube.
 boolean isChildOrEqualTo(Member member)
          Returns whether member is equal to, a child, or a descendent of this Member.
 boolean isChildOrEqualTo(String uniqueName)
          Returns whether this Member's unique name is equal to, a child of, or a descendent of a member whose unique name is uniqueName.
 boolean isHidden()
          Returns whether this member is 'hidden', as per the rules which define a ragged hierarchy.
 boolean isMeasure()
          Returns whether this is a member of the measures dimension.
 boolean isNull()
          Returns whether this is the 'null member'.
 OlapElement lookupChild(SchemaReader schemaReader, Id.Segment childName)
          Looks up a child element, returning null if it does not exist.
 OlapElement lookupChild(SchemaReader schemaReader, Id.Segment childName, MatchType matchType)
           
 
Methods inherited from class mondrian.olap.OlapElementBase
clone, computeHashCode, equals, equals, getLogger, hashCode, setCaption, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface mondrian.olap.Member
getDepth, getProperties, getPropertyValue, getPropertyValue, isCalculatedInQuery, setName, setProperty
 
Methods inherited from interface java.lang.Comparable
compareTo
 

Field Detail

parentMember

protected Member parentMember

level

protected final Level level

uniqueName

protected String uniqueName

flags

protected final int flags
Combines member type and other properties, such as whether the member is the 'all' or 'null' member of its hierarchy and whether it is a measure or is calculated, into an integer field.

The fields are:

NOTE: jhyde, 2007/8/10. It is necessary to cache whether the member is 'all', 'calculated' or 'null' in the member's state, because these properties are used so often. If we used a virtual method call - say we made each subclass implement 'boolean isNull()' - it would be slower. We use one flags field rather than 4 boolean fields to save space.


parentUniqueName

protected String parentUniqueName
Constructor Detail

MemberBase

protected MemberBase(Member parentMember,
                     Level level,
                     Member.MemberType memberType)

MemberBase

protected MemberBase()
Method Detail

getQualifiedName

public String getQualifiedName()
Description copied from interface: OlapElement
Returns the name of this element qualified by its class, for example "hierarchy 'Customers'".

Specified by:
getQualifiedName in interface OlapElement

getName

public abstract String getName()
Specified by:
getName in interface OlapElement

getUniqueName

public String getUniqueName()
Specified by:
getUniqueName in interface OlapElement

getCaption

public String getCaption()
Description copied from class: OlapElementBase
Returns the display name of this catalog element. If no caption is defined, the name is returned.

Specified by:
getCaption in interface OlapElement
Overrides:
getCaption in class OlapElementBase

getParentUniqueName

public String getParentUniqueName()
Description copied from interface: Member
Returns name of parent member, or empty string (not null) if we are the root.

Specified by:
getParentUniqueName in interface Member

getDimension

public Dimension getDimension()
Description copied from interface: OlapElement
Returns the dimension of a this expression, or null if no dimension is defined. Applicable only to set expressions.

Example 1:

 [Sales].children
 
has dimension [Sales].

Example 2:

 order(except([Promotion Media].[Media Type].members,
              {[Promotion Media].[Media Type].[No Media]}),
       [Measures].[Unit Sales], DESC)
 
has dimension [Promotion Media].

Example 3:

 CrossJoin([Product].[Product Department].members,
           [Gender].members)
 
has no dimension (well, actually it is [Product] x [Gender], but we can't represent that, so we return null);

Specified by:
getDimension in interface OlapElement

getHierarchy

public Hierarchy getHierarchy()
Specified by:
getHierarchy in interface Member
Specified by:
getHierarchy in interface OlapElement

getLevel

public Level getLevel()
Specified by:
getLevel in interface Member

getMemberType

public Member.MemberType getMemberType()
Description copied from interface: Member
Returns the type of member.

Specified by:
getMemberType in interface Member

getDescription

public String getDescription()
Specified by:
getDescription in interface OlapElement

isMeasure

public boolean isMeasure()
Description copied from interface: Member
Returns whether this is a member of the measures dimension.

Specified by:
isMeasure in interface Member

isAll

public boolean isAll()
Description copied from interface: Member
Returns whether this is the 'all' member.

Specified by:
isAll in interface Member

isNull

public boolean isNull()
Description copied from interface: Member
Returns whether this is the 'null member'.

Specified by:
isNull in interface Member

isCalculated

public boolean isCalculated()
Description copied from interface: Member
Returns whether this member is computed using either a with member clause in an mdx query or a calculated member defined in cube.

Specified by:
isCalculated in interface Member

lookupChild

public OlapElement lookupChild(SchemaReader schemaReader,
                               Id.Segment childName)
Description copied from interface: OlapElement
Looks up a child element, returning null if it does not exist.

Specified by:
lookupChild in interface OlapElement

lookupChild

public OlapElement lookupChild(SchemaReader schemaReader,
                               Id.Segment childName,
                               MatchType matchType)
Specified by:
lookupChild in interface OlapElement

getParentMember

public Member getParentMember()
Description copied from interface: Member
Returns this member's parent, or null (not the 'null member', as returned by Hierarchy.getNullMember()) if it has no parent.

In an access-control context, a member may have no visible parents, so use SchemaReader.getMemberParent(mondrian.olap.Member).

Specified by:
getParentMember in interface Member

isChildOrEqualTo

public boolean isChildOrEqualTo(Member member)
Description copied from interface: Member
Returns whether member is equal to, a child, or a descendent of this Member.

Specified by:
isChildOrEqualTo in interface Member

isChildOrEqualTo

public boolean isChildOrEqualTo(String uniqueName)
Returns whether this Member's unique name is equal to, a child of, or a descendent of a member whose unique name is uniqueName.


computeCalculated

protected boolean computeCalculated(Member.MemberType memberType)
Computes the value to be returned by isCalculated(), so it can be cached in a variable.

Parameters:
memberType - Member type
Returns:
Whether this member is calculated

getSolveOrder

public int getSolveOrder()
Specified by:
getSolveOrder in interface Member

getExpression

public Exp getExpression()
Returns the expression by which this member is calculated. The expression is not null if and only if the member is not calculated.

Specified by:
getExpression in interface Member
Post-condition:
(return != null) == (isCalculated())

getAncestorMembers

public Member[] getAncestorMembers()
Description copied from interface: Member
Returns array of all members, which are ancestor to this.

Specified by:
getAncestorMembers in interface Member

getOrdinal

public int getOrdinal()
Returns the ordinal of this member within its hierarchy. The default implementation returns -1.

Specified by:
getOrdinal in interface Member

getOrderKey

public Comparable getOrderKey()
Returns the order key of this member among its siblings. The default implementation returns null.

Specified by:
getOrderKey in interface Member

isHidden

public boolean isHidden()
Description copied from interface: Member
Returns whether this member is 'hidden', as per the rules which define a ragged hierarchy.

Specified by:
isHidden in interface Member

getDataMember

public Member getDataMember()
Description copied from interface: Member
Returns the system-generated data member that is associated with a nonleaf member of a dimension.

Returns this member if this member is a leaf member, or if the nonleaf member does not have an associated data member.

Specified by:
getDataMember in interface Member

getPropertyFormattedValue

public String getPropertyFormattedValue(String propertyName)
Description copied from interface: Member
Returns the formatted value of the property named propertyName.

Specified by:
getPropertyFormattedValue in interface Member

SourceForge.net_Logo