public class Walker extends Object implements Enumeration
Walkable
supply their children using
getChildren()
; other objects are assumed to have no children.
If the tree is modified during the enumeration, strange things may happen.
Example use:
Tree t;
Walker w = new Walker(t);
while (w.hasMoreElements()) {
Tree node = (Tree) w.nextNode();
System.out.println(node.toString());
}
Constructor and Description |
---|
Walker(mondrian.olap.Walkable root) |
Modifier and Type | Method and Description |
---|---|
Object |
currentElement()
returns the current object.
|
Object |
getAncestor(int iDepth) |
int |
getAncestorOrdinal(int iDepth)
get the ordinal within its parent node of the
iDepth th
ancestor. |
Object[] |
getChildren(Object node)
Override this function to prune the tree, or to allow objects which are
not Walkable to have children.
|
int |
getOrdinal()
get the ordinal within its parent node of the current node.
|
Object |
getParent() |
boolean |
hasMoreElements() |
int |
level()
returns level in the tree of the current element (that is, last element
returned from nextElement()).
|
static void |
main(String[] args) |
Object |
nextElement() |
void |
prune()
Tell walker that we don't want to visit any (more) children of this
node.
|
void |
pruneSiblings() |
public boolean hasMoreElements()
hasMoreElements
in interface Enumeration
public Object nextElement()
nextElement
in interface Enumeration
public void prune()
public void pruneSiblings()
public Object currentElement()
public int level()
public final Object getParent()
public final Object getAncestor(int iDepth)
public int getOrdinal()
public int getAncestorOrdinal(int iDepth)
iDepth
th
ancestor.public Object[] getChildren(Object node)
public static void main(String[] args)
Copyright © 2019 Hitachi Vantara. All rights reserved.