No, it is not possible to reset a Traverser. Traversers are effectively
Iterators that implement the Iterable interface for convenience (being
usable in the for each loop).

The way to get a restarted Traverser is to invoke node.traverse(...) again.

Happy hacking,
Tobias

On Tue, Feb 23, 2010 at 6:32 PM, Raul Raja Martinez <[email protected]>wrote:

> Hi,
>
> I was wondering if it is possible to reset a traverser iterator.
> Looking at the Traverser interface comment it says...
>
> // Doc: especially remove() thing
>    /**
>     * Returns an {...@link Iterator} representing the traversal of the graph.
> The
>     * iteration is completely lazy in that it will only traverse one step
> (to
>     * the next "hit") for every call to {...@code hasNext()}/{...@code 
> next()}.
>     *
>     * Consecutive calls to this method will return the same instance.
>     *
>     * @return An iterator for this traverser
>     */
>    // *TODO completely resolve issues regarding this (Iterable/Iterator
> ...)*
> *    // Doc: does it create a new iterator or reuse the existing one? This
> is*
> *    // very important! It must be re-use, how else would
> currentPosition()*
> *    // make sense?*
>    public Iterator<Node> iterator();
>
>
> thanks
> _______________________________________________
> Neo mailing list
> [email protected]
> https://lists.neo4j.org/mailman/listinfo/user
>



-- 
Tobias Ivarsson <[email protected]>
Hacker, Neo Technology
www.neotechnology.com
Cellphone: +46 706 534857
_______________________________________________
Neo mailing list
[email protected]
https://lists.neo4j.org/mailman/listinfo/user

Reply via email to