Class BroadFirstTreeIterator<N extends TreeNode<?,N>>
- java.lang.Object
-
- org.arakhne.afc.math.tree.iterator.AbstractBroadFirstTreeIterator<N,N>
-
- org.arakhne.afc.math.tree.iterator.BroadFirstTreeIterator<N>
-
- Type Parameters:
N
- is the type of the tree nodes.
- All Implemented Interfaces:
Iterator<N>
,NodeSelectionTreeIterator<N>
public class BroadFirstTreeIterator<N extends TreeNode<?,N>> extends AbstractBroadFirstTreeIterator<N,N> implements NodeSelectionTreeIterator<N>
This class is an iterator on a tree.The node A is treated before its children.
- Since:
- 13.0
- Version:
- 17.0 2020-01-04 14:41:41
- Author:
- Stéphane GALLAND
- Maven Group Id:
- org.arakhne.afc.core
- Maven Artifact Id:
- mathtree
-
-
Constructor Summary
Constructors Constructor Description BroadFirstTreeIterator(N node)
Create an iterator on the given node.BroadFirstTreeIterator(N node, NodeSelector<N> selector1)
Create an iterator on the given node.BroadFirstTreeIterator(Tree<?,N> tree)
Create an iterator on the given tree.BroadFirstTreeIterator(Tree<?,N> tree, NodeSelector<N> selector1)
Create an iterator on the given tree.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
setNodeSelector(NodeSelector<N> selector1)
Set the node selector used by this iterator.protected N
toTraversableChild(N parent, N child, int childIndex, int notNullChildIndex)
Replies an object to type N which is corresponding to the given child node retreived from the given parent node.-
Methods inherited from class org.arakhne.afc.math.tree.iterator.AbstractBroadFirstTreeIterator
getBroadFirstIterationListener, hasNext, next, onAfterChildNodes, onBeforeChildNodes, onBoardFirstIterationLevelFinished, remove, setBroadFirstIterationListener
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.util.Iterator
forEachRemaining, hasNext, next, remove
-
-
-
-
Constructor Detail
-
BroadFirstTreeIterator
public BroadFirstTreeIterator(Tree<?,N> tree)
Create an iterator on the given tree.- Parameters:
tree
- is the tree to iterate.
-
BroadFirstTreeIterator
public BroadFirstTreeIterator(Tree<?,N> tree, NodeSelector<N> selector1)
Create an iterator on the given tree.- Parameters:
tree
- is the tree to iterate.selector1
- permits to filter the node repliable by this iterator.
-
BroadFirstTreeIterator
public BroadFirstTreeIterator(N node)
Create an iterator on the given node.- Parameters:
node
- is the node to iterate.
-
BroadFirstTreeIterator
public BroadFirstTreeIterator(N node, NodeSelector<N> selector1)
Create an iterator on the given node.- Parameters:
node
- is the node to iterate.selector1
- permits to filter the node repliable by this iterator.
-
-
Method Detail
-
setNodeSelector
public void setNodeSelector(NodeSelector<N> selector1)
Description copied from interface:NodeSelectionTreeIterator
Set the node selector used by this iterator.- Specified by:
setNodeSelector
in interfaceNodeSelectionTreeIterator<N extends TreeNode<?,N>>
- Parameters:
selector1
- permits to filter the nodes replied/tranversed by this iterator.
-
toTraversableChild
@Pure protected N toTraversableChild(N parent, N child, int childIndex, int notNullChildIndex)
Description copied from class:AbstractBroadFirstTreeIterator
Replies an object to type N which is corresponding to the given child node retreived from the given parent node.- Specified by:
toTraversableChild
in classAbstractBroadFirstTreeIterator<N extends TreeNode<?,N>,N extends TreeNode<?,N>>
- Parameters:
parent
- is the node from which the child node was retreived.child
- is the child node to test.childIndex
- is the position of thechild
node in itsparent
.childIndex
is always greater or equal tonotNullChildIndex
.notNullChildIndex
- is the position of thechild
node in the list of the not-null nodes of itsparent
.notNullChildIndex
is always lower or equal tochildIndex
.- Returns:
- the traversable node, or
null
if the node is not traversable.
-
-