Package net.sf.basedb.util
Class Tree<E>
java.lang.Object
net.sf.basedb.util.Tree<E>
- All Implemented Interfaces:
Iterable<E>
,Collection<E>
- Version:
- 2.0
- Author:
- Nicklas
- Last modified
- $Date: 2015-05-12 11:27:08 +0200 (ti, 12 maj 2015) $
-
Nested Class Summary
Modifier and TypeClassDescriptionprivate class
An iterator that return elements for each node.static class
Represents an entry for a node in the tree.private class
An iterator that return entries for each node. -
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
Not supported.boolean
addAll
(Collection<? extends E> c) Not supported.private void
addEntry
(Tree.Entry<E> entry) void
clear()
Clear all elements except the root element.boolean
boolean
containsAll
(Collection<?> c) Create an iterator for the tree that returns entry object.entryIterator
(E node) Create an iterator for the tree starting at a specific node.boolean
Equality only tests if the object is the same instance of this tree.Get the entry for an arbitrary node.Get the entry for the root node.int
hashCode()
boolean
isEmpty()
iterator()
boolean
Not supported.boolean
removeAll
(Collection<?> c) Not supported.boolean
retainAll
(Collection<?> c) Not supported.int
size()
Object[]
toArray()
Not supported.<T> T[]
toArray
(T[] a) Not supported.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.util.Collection
parallelStream, removeIf, spliterator, stream, toArray
-
Field Details
-
root
-
entries
-
-
Constructor Details
-
Tree
Create a new tree with the with the default initial capacity (16).- Parameters:
root
- The root node element of the tree
-
Tree
Create a new tree with the with the specified initial capacity.- Parameters:
root
- The root node element of the treeinitialCapacity
- The initial capacity
-
-
Method Details
-
add
Not supported.- Specified by:
add
in interfaceCollection<E>
- Throws:
UnsupportedOperationException
- Always- See Also:
-
addAll
Not supported.- Specified by:
addAll
in interfaceCollection<E>
- Throws:
UnsupportedOperationException
- Always
-
clear
public void clear()Clear all elements except the root element.- Specified by:
clear
in interfaceCollection<E>
-
contains
- Specified by:
contains
in interfaceCollection<E>
-
containsAll
- Specified by:
containsAll
in interfaceCollection<E>
-
equals
Equality only tests if the object is the same instance of this tree. Note! In the future, the implementation may change to also check the entire tree structure.- Specified by:
equals
in interfaceCollection<E>
- Overrides:
equals
in classObject
-
hashCode
public int hashCode()- Specified by:
hashCode
in interfaceCollection<E>
- Overrides:
hashCode
in classObject
-
isEmpty
public boolean isEmpty()- Specified by:
isEmpty
in interfaceCollection<E>
-
iterator
-
remove
Not supported.- Specified by:
remove
in interfaceCollection<E>
- Throws:
UnsupportedOperationException
- Always
-
removeAll
Not supported.- Specified by:
removeAll
in interfaceCollection<E>
- Throws:
UnsupportedOperationException
- Always
-
retainAll
Not supported.- Specified by:
retainAll
in interfaceCollection<E>
- Throws:
UnsupportedOperationException
- Always
-
size
public int size()- Specified by:
size
in interfaceCollection<E>
-
toArray
Not supported.- Specified by:
toArray
in interfaceCollection<E>
- Throws:
UnsupportedOperationException
- Always
-
toArray
public <T> T[] toArray(T[] a) Not supported.- Specified by:
toArray
in interfaceCollection<E>
- Throws:
UnsupportedOperationException
- Always
-
getRootEntry
Get the entry for the root node.- Returns:
- The
Entry
object for the root node.
-
getEntry
Get the entry for an arbitrary node.- Parameters:
node
- The node to get the entry for.- Returns:
- An
Entry
object or null if the node isn't found
-
entryIterator
Create an iterator for the tree that returns entry object. The iterator starts at the root.- Returns:
- An
Iterator
object - See Also:
-
entryIterator
Create an iterator for the tree starting at a specific node.- Parameters:
node
- The node to start at- Returns:
- An
Iterator
object - See Also:
-
addEntry
-