|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.jcae.mesh.amibe.util.QSortedTree<E>
public abstract class QSortedTree<E>
Binary trees to store quality factors.
These trees are used to sort vertices, edges, or triangles according
to their quality factors, and to process them in increasing or decreasing
order after they have been sorted. They differ from casual binary trees in
that duplicate quality factors are allowed. See examples in algorithms from
org.jcae.mesh.amibe.algos3d
.
Nested Class Summary | |
---|---|
static class |
QSortedTree.Node<E>
|
Field Summary | |
---|---|
protected QSortedTree.Node<E> |
root
|
Constructor Summary | |
---|---|
QSortedTree()
|
Method Summary | |
---|---|
java.util.Iterator<QSortedTree.Node<E>> |
backwardIterator()
|
void |
clear()
Clear this tree. |
boolean |
contains(E o)
Checks whether an object exist is the tree. |
double |
getRootValue()
Return the value found at root binary tree. |
void |
insert(E o,
double value)
Insert a node to the tree. |
protected abstract boolean |
insertNode(QSortedTree.Node<E> node)
Insert a new note into the binary tree. |
boolean |
isEmpty()
Tell whether this tree is empty. |
java.util.Iterator<QSortedTree.Node<E>> |
iterator()
|
protected abstract QSortedTree.Node<E> |
newNode(E o,
double v)
Constructor to cast new nodes into subclass type. |
protected void |
readObject(java.io.ObjectInputStream s)
|
boolean |
remove(E o)
Remove the node associated to an object from the tree. |
protected abstract QSortedTree.Node<E> |
removeNode(QSortedTree.Node<E> p)
Remove a note from the binary tree. |
void |
show()
Pretty-print this tree. |
void |
showValues()
Pretty-print this tree. |
int |
size()
Return the object with the lowest quality factor. |
boolean |
update(E o,
double value)
Update the quality factor of an object, if it was already present in tree. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected final QSortedTree.Node<E> root
Constructor Detail |
---|
public QSortedTree()
Method Detail |
---|
protected abstract QSortedTree.Node<E> newNode(E o, double v)
protected abstract boolean insertNode(QSortedTree.Node<E> node)
true
.
protected abstract QSortedTree.Node<E> removeNode(QSortedTree.Node<E> p)
protected void readObject(java.io.ObjectInputStream s) throws java.io.IOException, java.lang.ClassNotFoundException
java.io.IOException
java.lang.ClassNotFoundException
public boolean isEmpty()
public final void insert(E o, double value)
value
, and duplicates are not checked.
o
- objectvalue
- quality factorpublic final boolean remove(E o)
o
- object being removed
true
if node was present in tree,
false otherwise.public final boolean update(E o, double value)
o
- object being updatedvalue
- new quality factor
true
if object was present in tree,
false
otherwise.public void clear()
public void show()
public void showValues()
public final boolean contains(E o)
o
- object being checked
true
if this tree contains this object,
false
otherwise.public final int size()
public final double getRootValue()
public java.util.Iterator<QSortedTree.Node<E>> iterator()
public java.util.Iterator<QSortedTree.Node<E>> backwardIterator()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |