com.sas.mdtable
Class AbstractHierarchy

java.lang.Object
  |
  +--com.sas.mdtable.AbstractNode
        |
        +--com.sas.mdtable.AbstractHierarchy
All Implemented Interfaces:
HierarchyInterface, NodeInterface, NodeInterface, SimpleNodeInterface

public abstract class AbstractHierarchy
extends AbstractNode
implements HierarchyInterface

Defines an abstract base class for an implementation of HierarchyInterface.

See Also:
AbstractAxis, AbstractDimension, AbstractLevel, AbstractMember

Constructor Summary
AbstractHierarchy(DimensionInterface dimension)
          Constructor.
 
Method Summary
 DimensionInterface getDimension()
          Returns the dimension that this hierarchy is a child of.
 LevelInterface[] getLevels(int index, int count)
          Returns the levels associated with a given range of indices.
 SimpleNodeInterface getNodeChild(int index)
          Alias for getLevel.
 int getNodeChildCount()
          Alias for getLevelCount.
 SimpleNodeInterface[] getNodeChildren(int index, int count)
          Alias for getLevels.
 String getNodeType()
          Returns the hierarchy's type.
 boolean isLeafNode()
          Returns false since hierarchies parent levels.
 
Methods inherited from class com.sas.mdtable.AbstractNode
getNodeExpandedText, getNodeText
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.sas.mdtable.HierarchyInterface
getLevel, getLevelCount, getMetaHierarchy
 
Methods inherited from interface com.sas.mdtable.NodeInterface
getLabel, getName
 
Methods inherited from interface com.sas.models.NodeInterface
getNodeExpandedText, getNodeText
 
Methods inherited from interface com.sas.models.SimpleNodeInterface
countNodeChildren
 

Constructor Detail

AbstractHierarchy

public AbstractHierarchy(DimensionInterface dimension)
Constructor.
Parameters:
dimension - The dimension that parents this hierarchy.
Method Detail

getDimension

public final DimensionInterface getDimension()
Returns the dimension that this hierarchy is a child of.
Specified by:
getDimension in interface HierarchyInterface
Returns:
The dimension that parents this hierarchy.

getLevels

public LevelInterface[] getLevels(int index,
                                  int count)
                           throws TableException
Returns the levels associated with a given range of indices. The default implementation simply calls getLevel count-times; subclass should override if it can do so more efficiently.
Specified by:
getLevels in interface HierarchyInterface
Parameters:
index - A zero-based level index (0 to getLevelCount()-1).
count - The number of levels to return.
Returns:
An array whose first element is the level associated with index, whose second element is the level associated with index+1, and so on such that array[array.length-1] is the level associated with index+count-1.
Throws:
TableException - Thrown if the query can not be satisfied (e.g. i/o-failure).
IndexOutOfBoundsException - Thrown if index is negative, or greater than or equal to getLevelCount().

getNodeChild

public final SimpleNodeInterface getNodeChild(int index)
Alias for getLevel. If getLevel fails (throws TableException), NoSuchElementException is thrown.
Specified by:
getNodeChild in interface SimpleNodeInterface
Parameters:
index - A zero-based level index (0 to getLevelCount()-1).
Returns:
The level associated with index.
See Also:
HierarchyInterface.getLevel(int)

getNodeChildCount

public final int getNodeChildCount()
Alias for getLevelCount. If getLevelCount fails (throws TableException), zero is returned.
Specified by:
getNodeChildCount in interface SimpleNodeInterface
Returns:
The number of levels.
See Also:
HierarchyInterface.getLevelCount()

getNodeChildren

public final SimpleNodeInterface[] getNodeChildren(int index,
                                                   int count)
Alias for getLevels. If getLevels fails (throws TableException), a zero-length array is returned.
Specified by:
getNodeChildren in interface SimpleNodeInterface
Parameters:
index - A zero-based level index (0 to getLevelCount()-1).
count - The number of levels to return.
Returns:
An array whose first element is the level associated with index, whose second element is the level associated with index+1, and so on such that array[array.length-1] is the level associated with index+count-1.
See Also:
HierarchyInterface.getLevels(int, int)

getNodeType

public String getNodeType()
Returns the hierarchy's type. The type serves to categorize a node, i.e. identify it as belonging to a particular group.
Specified by:
getNodeType in interface NodeInterface
Returns:
"hierarchy".

isLeafNode

public final boolean isLeafNode()
Returns false since hierarchies parent levels.
Specified by:
isLeafNode in interface SimpleNodeInterface
Returns:
False.




Copyright © 2005 SAS Institute Inc. All Rights Reserved.
javadoc generated Thu, 16 Feb 2006 02:03:22