com.sas.storage.olap.embedded
Class TupleElement

com.sas.storage.olap.embedded.TupleElement
All Implemented Interfaces:
TupleElementInterface

public class TupleElement
implements TupleElementInterface

This implementation is designed for the simple definition of tuple elements in a multidimensional ResultSet. The tuple elements are stored in memory within the model

The tuple element is the building block of the metadata for the result set. There are a set of tuple elements associated with each tuple, and each of these tuple elements contains information that is essential for rendering a multidimensional result set. The most basic piece is the label, which can be set with the setLabel() method.

See Also:
Tuple,


Constructor Summary
TupleElement()
           
TupleElement(java.lang.String name)
          Constructor that takes a unique name for this tuple element
TupleElement(TupleElementInterface tupleElement)
           
 
Method Summary
 int getChildCount()
          Returns the number of children for this member.
 java.lang.String getFormat()
          This method will always return null for now.
 java.lang.String getLabel()
          Return the label for the tuple element.
 int getLevelDepth()
          Return the number of levels associated with this tupleElement.
 int getMaximumCoordinate()
          Returns the largest axis coordinate spanned by the label.
 int getMinimumCoordinate()
          Returns the smallest axis coordinate spanned by the label.
 java.lang.String getName()
          Returns a unique name for the tuple element.
 java.util.Map getProperties()
          Returns additional properties that were specified for this element
 int getSpan()
          Return the span for this tuple element
 int getSpanDepth()
          Get the span depth of this tupleelement.
 TupleInterface getTuple()
          Return the parent tuple for this tuple element
 int getTupleElementIndex()
          Return unique index of this tuple element
 com.sas.storage.olap.TupleElementType getType()
          Get the type of this tupleelement.
 java.lang.String getUniqueLevelName()
          Return the unique level name that this element is associated with
 boolean isContextual()
          This method indicates whether this tuple element is part of the basic result set or added for additional info.
 boolean isContinued()
          Returns whether this member's parent is the same as the parent of the immediately preceding member.
 boolean isDrilledDown()
          Returns whether this member is drilled down.
 void setChildCount(int childCount)
          Sets the number of children for this member.
 void setContextual(boolean isContextual)
          Set whether this tuple is part of the basic result set
 void setContinued(boolean isContinued)
          Sets whether this member's parent is the same as the parent of the immediately preceding member.
 void setDrilledDown(boolean isDrilledDown)
          Sets whether this member is drilled down.
 void setLabel(java.lang.String label)
          Set the label for the tuple element.
 void setLevelDepth(int levelDepth)
          Set the levelDepth for this tuple element.
 void setMaximumCoordinate(int maximumCoordinate)
          Sets the largest axis coordinate spanned by the label.
 void setMinimumCoordinate(int minimumCoordinate)
          Sets the smallest axis coordinate spanned by the label.
 void setName(java.lang.String name)
          Sets the unique name for the tuple element.
 void setProperties(java.util.Map properties)
          Sets additional properties that were specified for this element
 void setSpan(int span)
          Set the span value of this element
 void setSpanDepth(int depth)
          Set the spanDepth for this tuple element.
 void setTuple(TupleInterface tuple)
          Set the parent tuple of this tuple element
 void setType(com.sas.storage.olap.TupleElementType elementType)
          Set the type of this element.
 void setUniqueLevelName(java.lang.String uniqueLevelName)
          Set unique level name for this element
 java.lang.String toString()
          Returns the label of this tuple element
 

Constructor Detail

TupleElement

public TupleElement()

TupleElement

public TupleElement(java.lang.String name)
Constructor that takes a unique name for this tuple element

Parameters:
name - tuple element name.

TupleElement

public TupleElement(TupleElementInterface tupleElement)
             throws OLAPException
Throws:
OLAPException
Method Detail

setType

public void setType(com.sas.storage.olap.TupleElementType elementType)
             throws OLAPException
Set the type of this element.

Parameters:
elementType - of this element. Currently supported types are TupleElementType.MEASURE, TupleElementType.TOTAL, TupleElementType.SUBTOTAL, TupleElementType.UNSPECIFIED.
Throws:
OLAPException

getType

public com.sas.storage.olap.TupleElementType getType()
                                              throws OLAPException
Get the type of this tupleelement. Currently supported types are TupleElementType.MEASURE, TupleElementType.TOTAL, TupleElementType.SUBTOTAL, TupleElementType.UNSPECIFIED.

Specified by:
getType in interface TupleElementInterface
Returns:
type of this element.
Throws:
OLAPException

setLabel

public void setLabel(java.lang.String label)
              throws OLAPException
Set the label for the tuple element.

Parameters:
label - The label for the tuple element.
Throws:
OLAPException - if the label cannot be set

getLabel

public java.lang.String getLabel()
                          throws OLAPException
Return the label for the tuple element. If no label is set will return the unique name

Specified by:
getLabel in interface TupleElementInterface
Returns:
The label for the tuple element.
Throws:
OLAPException - if cannot get the label

setName

public void setName(java.lang.String name)
             throws OLAPException
Sets the unique name for the tuple element.

Parameters:
name - The unique name for the tuple element.
Throws:
OLAPException - if name cannot be set

getName

public java.lang.String getName()
Returns a unique name for the tuple element.

Specified by:
getName in interface TupleElementInterface
Returns:
The unique name for the tuple element.
Throws:
OLAPException - if a name cannot be returned

getUniqueLevelName

public java.lang.String getUniqueLevelName()
                                    throws OLAPException
Return the unique level name that this element is associated with

Specified by:
getUniqueLevelName in interface TupleElementInterface
Returns:
The level name that this element is associated with.
Throws:
OLAPException

setUniqueLevelName

public void setUniqueLevelName(java.lang.String uniqueLevelName)
                        throws OLAPException
Set unique level name for this element

Parameters:
The - level name that this element is associated with.
Throws:
OLAPException

setDrilledDown

public void setDrilledDown(boolean isDrilledDown)
                    throws OLAPException
Sets whether this member is drilled down. That is, at least one child of this member appears on the axis, immediately following the member.

Parameters:
drilledDown - Indicates whether this member is drilled down. That is, at least one child of this member appears on the axis, immediately following the member.
Throws:
OLAPException

isDrilledDown

public boolean isDrilledDown()
                      throws OLAPException
Returns whether this member is drilled down. That is, at least one child of this member appears on the axis, immediately following the member.

Specified by:
isDrilledDown in interface TupleElementInterface
Returns:
Indicates whether this member is drilled down. That is, at least one child of this member appears on the axis, immediately following the member.
Throws:
OLAPException

setContinued

public void setContinued(boolean isContinued)
                  throws OLAPException
Sets whether this member's parent is the same as the parent of the immediately preceding member.

Parameters:
sameParent - Indicates whether this member's parent is the same as the parent of the immediately preceding member.
Throws:
OLAPException

isContinued

public boolean isContinued()
                    throws OLAPException
Returns whether this member's parent is the same as the parent of the immediately preceding member.

Specified by:
isContinued in interface TupleElementInterface
Returns:
Indicates whether this member's parent is the same as the parent of the immediately preceding member.
Throws:
OLAPException

setChildCount

public void setChildCount(int childCount)
                   throws OLAPException
Sets the number of children for this member.

Parameters:
childCount - The number of children for this member.
Throws:
OLAPException

getChildCount

public int getChildCount()
                  throws OLAPException
Returns the number of children for this member.

Specified by:
getChildCount in interface TupleElementInterface
Returns:
The number of children for this member.
Throws:
OLAPException

setProperties

public void setProperties(java.util.Map properties)
                   throws OLAPException
Sets additional properties that were specified for this element

Parameters:
properties - A PropertyBagInterface containing the additional properties that may have been specified for this tuple element.
Throws:
OLAPException

getProperties

public java.util.Map getProperties()
                            throws OLAPException
Returns additional properties that were specified for this element

Specified by:
getProperties in interface TupleElementInterface
Returns:
A PropertyBagInterface containing the additional properties that may have been specified for this tuple element.
Throws:
OLAPException

getSpan

public int getSpan()
            throws OLAPException
Return the span for this tuple element

Specified by:
getSpan in interface TupleElementInterface
Returns:
the span value of this tuple element
Throws:
OLAPException

setSpan

public void setSpan(int span)
             throws OLAPException
Set the span value of this element

Specified by:
setSpan in interface TupleElementInterface
Parameters:
span - value of this element
Throws:
OLAPException

setMinimumCoordinate

public void setMinimumCoordinate(int minimumCoordinate)
                          throws OLAPException
Sets the smallest axis coordinate spanned by the label. This is calculated based on tuple/axis If this is a leaf label, getMinimumCoordinate() will equal getMaximumCoordinate(). This value may be changed internally if is not set correctly. Set the minimumCoordinate last if do not want it overwritten.

Specified by:
setMinimumCoordinate in interface TupleElementInterface
Parameters:
minimumCoordinate - A zero-based integer that identifies a point along the axis.
Throws:
OLAPException
See Also:
getMaximumCoordinate()

getMinimumCoordinate

public int getMinimumCoordinate()
                         throws OLAPException
Returns the smallest axis coordinate spanned by the label. If this is a leaf label, getMinimumCoordinate() will equal getMaximumCoordinate().

Specified by:
getMinimumCoordinate in interface TupleElementInterface
Returns:
A zero-based integer that identifies a point along the axis.
Throws:
OLAPException
See Also:
getMaximumCoordinate()

setMaximumCoordinate

public void setMaximumCoordinate(int maximumCoordinate)
                          throws OLAPException
Sets the largest axis coordinate spanned by the label. If this is a leaf label, getMinimumCoordinate() will equal getMaximumCoordinate(). This value may be changed internally if is not set correctly. Set the maximumCoordinate last if do not want it overwritten.

Specified by:
setMaximumCoordinate in interface TupleElementInterface
Parameters:
maximumCoordinate - A zero-based integer that identifies a point along the axis.
Throws:
OLAPException
See Also:
getMinimumCoordinate()

getMaximumCoordinate

public int getMaximumCoordinate()
                         throws OLAPException
Returns the largest axis coordinate spanned by the label. If this is a leaf label, getMinimumCoordinate() will equal getMaximumCoordinate().

Specified by:
getMaximumCoordinate in interface TupleElementInterface
Returns:
A zero-based integer that identifies a point along the axis.
Throws:
OLAPException
See Also:
getMinimumCoordinate()

getTuple

public TupleInterface getTuple()
                        throws OLAPException
Return the parent tuple for this tuple element

Specified by:
getTuple in interface TupleElementInterface
Returns:
parent tuple of this tuple element
Throws:
OLAPException

setTuple

public void setTuple(TupleInterface tuple)
              throws OLAPException
Set the parent tuple of this tuple element

Parameters:
parent - tuple of this tuple element
Throws:
OLAPException

getTupleElementIndex

public int getTupleElementIndex()
                         throws OLAPException
Return unique index of this tuple element

Specified by:
getTupleElementIndex in interface TupleElementInterface
Returns:
unique index for this tuple element
Throws:
OLAPException

getLevelDepth

public int getLevelDepth()
                  throws OLAPException
Return the number of levels associated with this tupleElement. Whatever is set is returned.

Specified by:
getLevelDepth in interface TupleElementInterface
Returns:
level depth
Throws:
OLAPException

setLevelDepth

public void setLevelDepth(int levelDepth)
                   throws OLAPException
Set the levelDepth for this tuple element. The level depth is a distance of level from the root of the hierarchy, where root level is zero. eg. Time Hierarchy has Year, Quarter and Month levels with any tuple element (1993) for year levelat tuple depth 0, a tuple element (Q1) at quarter level at level depth 1 and any tuple element (Jan) at Month level at tuple depth 2.

Parameters:
levelDepth - number of levels above this tuple element
Throws:
OLAPException

isContextual

public boolean isContextual()
                     throws OLAPException
This method indicates whether this tuple element is part of the basic result set or added for additional info. For example, a Tuple element 1993 could be added to provide additional info for a tuple element Q1, since Q1 can belong to 1994. 1993 is not part of the result set but is added to provide additional info.

Specified by:
isContextual in interface TupleElementInterface
Returns:
true is this tuple element is added for additional info
Throws:
OLAPException

setContextual

public void setContextual(boolean isContextual)
                   throws OLAPException
Set whether this tuple is part of the basic result set

Parameters:
isContextual - set whether this tuple is part of the basic resultset
Throws:
OLAPException
See Also:
isContextual

getFormat

public java.lang.String getFormat()
                           throws OLAPException
This method will always return null for now.

Specified by:
getFormat in interface TupleElementInterface
Returns:
the Format associated with this tuple element
Throws:
OLAPException

getSpanDepth

public int getSpanDepth()
                 throws OLAPException
Get the span depth of this tupleelement. This tells the depth of the element within the spanned value

Specified by:
getSpanDepth in interface TupleElementInterface
Returns:
the position of the elment within the spanned value
Throws:
OLAPException
See Also:
TupleElementInterface.getSpanDepth()

setSpanDepth

public void setSpanDepth(int depth)
Set the spanDepth for this tuple element. Span depth is the position of the element within the spanned value. It is 1 always except in case of ragged hierarchy.

Specified by:
setSpanDepth in interface TupleElementInterface
See Also:
TupleElementInterface.setSpanDepth(int)

toString

public java.lang.String toString()
Returns the label of this tuple element

Overrides:
toString in class java.lang.Object
Returns:
label of tuple element
See Also:
Object.toString()



Copyright © 2009 SAS Institute Inc. All Rights Reserved.