ch.bfh.algo.core
Interface GenericForest<E,P extends GenericPosition<E,P>>

All Superinterfaces:
Collection<E>, Container<E>, Forest<E>, GenericContainer<E,P>, Iterable<E>
All Known Implementing Classes:
DefaultBinaryForest, DefaultForest, GenericBinaryForestGraph, GenericForestGraph

public interface GenericForest<E,P extends GenericPosition<E,P>>
extends GenericContainer<E,P>, Forest<E>


Method Summary
 PositionList<E,P> children(Position<?> parent)
          Returns the list of the children of a given node.
 P parent(Position<?> child)
          Returns the parent of the given node.
 PositionList<E,P> roots()
          Returns the list of the roots contained in the forest.
 
Methods inherited from interface ch.bfh.algo.core.GenericContainer
insert, positionIterator
 
Methods inherited from interface ch.bfh.algo.Container
delete, element, encloses, replace, swap
 
Methods inherited from interface java.util.Collection
add, addAll, clear, contains, containsAll, equals, hashCode, isEmpty, iterator, remove, removeAll, retainAll, size, toArray, toArray
 
Methods inherited from interface ch.bfh.algo.Forest
cut, link, linkAfter, linkBefore
 
Methods inherited from interface ch.bfh.algo.Container
delete, element, encloses, replace, swap
 
Methods inherited from interface java.util.Collection
add, addAll, clear, contains, containsAll, equals, hashCode, isEmpty, iterator, remove, removeAll, retainAll, size, toArray, toArray
 

Method Detail

roots

PositionList<E,P> roots()
Description copied from interface: Forest
Returns the list of the roots contained in the forest. I.e. all the nodes without parent.

Specified by:
roots in interface Forest<E>
Returns:
the list containing all roots.

parent

P parent(Position<?> child)
Description copied from interface: Forest
Returns the parent of the given node. We get a child and return its parent

Specified by:
parent in interface Forest<E>
Parameters:
child - the node we are looking at
Returns:
the parent of child.

children

PositionList<E,P> children(Position<?> parent)
Description copied from interface: Forest
Returns the list of the children of a given node. We receive a parent node and return the list of its children.

Specified by:
children in interface Forest<E>
Parameters:
parent - the node we are looking at
Returns:
the list of all the children of parent.