uoc.ei.tads
Class ArbreBinari.RecorregutPerNivell<E>

java.lang.Object
  extended by uoc.ei.tads.ArbreBinari.RecorregutPerNivell<E>
All Implemented Interfaces:
java.io.Serializable, Recorregut<E>
Enclosing class:
ArbreBinari<E>

protected static class ArbreBinari.RecorregutPerNivell<E>
extends java.lang.Object
implements Recorregut<E>

Classe que proporciona un recorregut de les posicions. Basada en el pattern Iterator, soporta múltiples recorreguts simultanis i independents del contenidor. És sensible a eventuals alteracions de l'estructura de posicions.

See Also:
Recorregut.hiHaSeguent(), Recorregut.seguent(), Serialized Form

Field Summary
protected  Cua<Posicio<E>> cua
          Cua auxiliar.
 
Constructor Summary
ArbreBinari.RecorregutPerNivell(ArbreBinari<E> arbre)
          Constructor sense paràmetres.
 
Method Summary
 boolean hiHaSeguent()
          Comprova si hi ha una primera o següent posició.
 Posicio<E> seguent()
          Primer avança, si es pot, i després retorna la posició.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

cua

protected Cua<Posicio<E>> cua
Cua auxiliar.

Constructor Detail

ArbreBinari.RecorregutPerNivell

public ArbreBinari.RecorregutPerNivell(ArbreBinari<E> arbre)
Constructor sense paràmetres.

Method Detail

hiHaSeguent

public boolean hiHaSeguent()
Comprova si hi ha una primera o següent posició. És sensible a eventuals alteracions de l'estructura de posicions. Retorna fals si el contenidor està buit o ja s'ha visitat l'última posició.

Specified by:
hiHaSeguent in interface Recorregut<E>
Returns:
cert o fals, segons si es pot avançar o no es pot

seguent

public Posicio<E> seguent()
                   throws ExcepcioPosicioInvalida
Primer avança, si es pot, i després retorna la posició. Si no hi ha següent posició llança una excepció.

Specified by:
seguent in interface Recorregut<E>
Returns:
següent posició
Throws:
ExcepcioPosicioInvalida - si es vol obtenir el següent element de l'enumeració i no n'hi ha cap o no n'hi ha cap més