E
- the type of elements in this treepublic class UnorderedTree<E> extends AbstractTree<E>
PAREN_END, PAREN_START
Constructor and Description |
---|
UnorderedTree()
Public constructor.
|
UnorderedTree(E element)
Public constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
add(UnorderedTree<E> child)
Adds the given child to this node.
|
void |
addChild(E element)
Adds a child with the given element to this node.
|
void |
addChild(UnorderedTree<E> child)
Adds the given child to this node.
|
UnorderedTree<E> |
find(E element)
Finds a node of the first occurrence of the given element in this tree.
|
UnorderedTree<E> |
findChild(E element)
Finds a child of the first occurrence of the given element in this node.
|
java.util.List<E> |
getAncestorElements()
Returns a list of elements of ancestors of this node, ordered from the root to the parent of
this node.
|
java.util.List<UnorderedTree<E>> |
getAncestors()
Returns a list of ancestors of this node, ordered from the root to the parent of this node.
|
com.google.common.collect.Multiset<UnorderedTree<E>> |
getChildren()
Returns a set of children of this node.
|
java.util.List<E> |
getElements()
Returns a list of all elements in this tree.
|
java.util.List<UnorderedTree<E>> |
getLeaves()
Returns a list of leaves in this tree in a natural order.
|
java.util.List<Tree<E>> |
getNodes()
Returns a list of all nodes of the type
Tree<E> in this tree. |
UnorderedTree<E> |
getParent()
Returns the parent of this node.
|
UnorderedTree<E> |
getRoot()
Returns the root of this tree.
|
com.google.common.collect.Multiset<E> |
getSiblingElements()
Returns a list of elements of siblings of this node.
|
com.google.common.collect.Multiset<UnorderedTree<E>> |
getSiblings()
Returns a list of siblings of this node.
|
java.util.List<UnorderedTree<E>> |
getSubtrees()
Returns a list of subtrees of this tree.
|
java.util.List<UnorderedTree<E>> |
getUnorderedTreeNodes()
Returns a list of all nodes of the type
UnorderedTree<E> in this tree. |
boolean |
hasChild(E element)
Returns
true if this node has a child with the given element. |
boolean |
hasChild(UnorderedTree<E> child)
Returns
true if this node has the given child. |
int |
numChildren()
Returns the number of children of this node.
|
int |
numSiblings()
Returns the number of siblings of this node.
|
void |
remove()
Removes this node.
|
void |
removeChild(E element)
Removes a child with the given element from this node.
|
void |
removeChild(UnorderedTree<E> child)
Removes the given child.
|
void |
removeChildren()
Removes all children from this node.
|
void |
setParent(UnorderedTree<E> parent)
Sets the given parent to this node.
|
java.lang.String |
toNewick()
Returns a string representation of this tree in the Newick standard format.
|
java.lang.String |
toNewick(java.lang.String startMark,
java.lang.String endMark)
Returns a string representation of this tree in the Newick standard format with the given
starting and ending mark.
|
java.lang.String |
toString()
Returns a string representation of this tree in the format of the UNIX 'tree' command.
|
add, degree, degree, depth, depth, getElement, getLeafElements, hasAncestor, hasAncestor, hasChild, hasDescendant, hasDescendant, hasElement, hasElement, hasParent, hasParent, hasParent, isBalanced, isLabeled, isLabeledTree, isLeaf, isRoot, iterator, numLeaves, removeChildren, setElement, size, yield
addAll, clear, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
public UnorderedTree()
public UnorderedTree(E element)
element
- an element of this nodepublic java.lang.String toString()
toString
in class java.util.AbstractCollection<E>
public java.lang.String toNewick()
public java.lang.String toNewick(java.lang.String startMark, java.lang.String endMark)
startMark
- a string to start with a string presentation of a nodeendMark
- a string to end with a string presentation of a nodepublic UnorderedTree<E> find(E element)
element
- an element to be found in this tree, if presentpublic UnorderedTree<E> findChild(E element)
element
- an element to be found in the children of this node, if presentpublic UnorderedTree<E> getParent()
public void setParent(UnorderedTree<E> parent)
parent
- a parent that will be set to this nodepublic com.google.common.collect.Multiset<UnorderedTree<E>> getChildren()
public int numChildren()
public boolean hasChild(E element)
true
if this node has a child with the given element.element
- an element whose presence in the children of this node will be testedtrue
if this node has a child with the given element; false
otherwisepublic boolean hasChild(UnorderedTree<E> child)
true
if this node has the given child.child
- a node whose presence in the children of this node will be testedtrue
if this node has the given child; false
otherwisepublic void add(UnorderedTree<E> child)
child
- a child that will be added to this nodepublic void addChild(UnorderedTree<E> child)
child
- a child that will be added to this nodepublic void addChild(E element)
element
- an element that will be added to the children of this nodepublic java.util.List<UnorderedTree<E>> getUnorderedTreeNodes()
UnorderedTree<E>
in this tree.UnorderedTree<E>
in this treepublic java.util.List<Tree<E>> getNodes()
Tree<E>
in this tree.Tree<E>
in this treepublic java.util.List<E> getElements()
public void remove()
public void removeChild(UnorderedTree<E> child)
child
- a node to be removed from the children of this nodepublic void removeChild(E element)
element
- a node to be removed from the children of this nodepublic void removeChildren()
Tree
public com.google.common.collect.Multiset<UnorderedTree<E>> getSiblings()
public com.google.common.collect.Multiset<E> getSiblingElements()
public int numSiblings()
public UnorderedTree<E> getRoot()
public java.util.List<UnorderedTree<E>> getAncestors()
public java.util.List<E> getAncestorElements()
public java.util.List<UnorderedTree<E>> getSubtrees()
public java.util.List<UnorderedTree<E>> getLeaves()