Projecto
Class RectIntersectIterator

java.lang.Object
  extended by Projecto.RectIntersectIterator
All Implemented Interfaces:
Iterator

public class RectIntersectIterator
extends java.lang.Object
implements Iterator

Classe que implementa a interface Iterator. A sua função é iterar sobre as figuras do mesmo tipo. Docente: Hugo Vieira P3

Author:
Ricardo Gaspar Nr: 35277, Tiago Silva Nr: 35411

Constructor Summary
RectIntersectIterator(Geometric_Figure[] figures, int counter, double xUpperLeft, double yUpperLeft, double xLowerRight, double yLowerRight)
          Construtor do iterador.
 
Method Summary
 boolean hasNext()
          Verifica se existe mais algum elemento a visitar
 void init()
          Vai para o início da colecção
 Geometric_Figure next()
          Devolve o próximo elemento a visitar na colecção.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RectIntersectIterator

public RectIntersectIterator(Geometric_Figure[] figures,
                             int counter,
                             double xUpperLeft,
                             double yUpperLeft,
                             double xLowerRight,
                             double yLowerRight)
Construtor do iterador.

Parameters:
figures - - vector de figurar sobre o qual vai ser feita a iteração.
counter - - número de figuras existentes no vector.
xUpperLeft - - Coordenada X do ponto superior esquerdo do rectângulo envolvente.
yUpperLeft - - Coordenada Y do ponto superior esquerdo do rectângulo envolvente.
xLowerRight - - Coordenada X do ponto inferior direito do rectângulo envolvente.
yLowerRight - - Coordenada Y do ponto inferior direito do rectângulo envolvente.
Method Detail

init

public void init()
Description copied from interface: Iterator
Vai para o início da colecção

Specified by:
init in interface Iterator

hasNext

public boolean hasNext()
Description copied from interface: Iterator
Verifica se existe mais algum elemento a visitar

Specified by:
hasNext in interface Iterator
Returns:
true, se houver mais elementos a visitar, false, caso contrário

next

public Geometric_Figure next()
Description copied from interface: Iterator
Devolve o próximo elemento a visitar na colecção.

Specified by:
next in interface Iterator
Returns:
O próximo elemento a visitar, se existir, ou null, caso contrário.