+VarTree::Iterator VarTree::getPrevItem( Iterator it )
+{
+ VarTree::Iterator it_old = it;
+ if( it == root()->begin() || it == ++(root()->begin()) ) return it;
+
+ /* Was it the first child of its parent ? */
+ if( it->parent() && it == it->parent()->begin() )
+ {
+ /* Yes, get previous uncle */
+ it = it_old->prev_uncle();
+ }
+ else
+ it--;
+
+ /* We have found an expanded uncle, take its last child */
+ while( it != root()->begin() && it->size() )
+ {
+ it = it->end();
+ it--;
+ }
+ return it;
+}
+
+VarTree::Iterator VarTree::getNextLeaf( Iterator it )
+{
+ do
+ {
+ it = getNextItem( it );
+ }
+ while( it != root()->end() && it->size() );
+ return it;
+}
+
+VarTree::Iterator VarTree::getPrevLeaf( Iterator it )
+{
+ do
+ {
+ it = getPrevItem( it );
+ }
+ while( it != root()->begin() && it->size() ); /* FIXME ? */
+ if( it == root()->begin() ) it = firstLeaf();
+ return it;
+}