|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.init.its.simplemodel.BaseTree<T>
T
- public class BaseTree<T>
Simple tree implementation
Field Summary | |
---|---|
protected java.util.List<BaseTree<T>> |
children
|
protected static java.lang.String |
EOL
|
protected T |
head
|
protected java.util.Map<T,BaseTree<T>> |
mapping
|
protected BaseTree<T> |
parent
|
Constructor Summary | |
---|---|
BaseTree()
|
|
BaseTree(T head)
Creates a new Tree with an head element |
Method Summary | |
---|---|
java.util.List<BaseTree<T>> |
getChildren()
Returns the children of this node |
T |
getHead()
Returns the head of this node |
BaseTree<T> |
getParent()
Returns the parent of this node |
java.util.Collection<T> |
getSuccessors()
returns the successive elements of this node |
java.util.Collection<T> |
getSuccessors(T root)
returns the successors ofthe root element |
boolean |
hasChildren()
Returns true, if this subtree contains children |
BaseTree<T> |
insert(T node)
Inserts an element as child to this tree and returns the child subtree |
BaseTree<T> |
insert(T parent,
T node)
Inserts an element as child for the parent and returns the child subtree |
java.lang.String |
print()
prints the tree |
BaseTree<T> |
remove(T node)
Removes a node form the tree and returns the subtree |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static final java.lang.String EOL
protected BaseTree<T> parent
protected T head
protected java.util.List<BaseTree<T>> children
protected java.util.Map<T,BaseTree<T>> mapping
Constructor Detail |
---|
public BaseTree(T head)
head
- public BaseTree()
Method Detail |
---|
public BaseTree<T> insert(T parent, T node)
parent
- node
-
public BaseTree<T> insert(T node)
node
-
public BaseTree<T> remove(T node)
node
-
public T getHead()
public BaseTree<T> getParent()
public java.util.List<BaseTree<T>> getChildren()
public boolean hasChildren()
public java.util.Collection<T> getSuccessors()
public java.util.Collection<T> getSuccessors(T root)
root
-
public java.lang.String print()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |