|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objecttecgraf.javautils.xml.ImprovedXMLListIterator
public class ImprovedXMLListIterator
A classe NewXMLListIterator implementa uma nova versão do
iterador sobre elementos XML coletados pelo parser.
Esta versão é baseada em um array (ao invés de uma lista, como na
implementação original), o que simplifica muito a implementação não só das
operações definidas na interface como operações extra como
hasAny(String) e howManyLeft(String).
| Field Summary |
|---|
| Fields inherited from interface tecgraf.javautils.xml.XMLListIteratorInterface |
|---|
ANY |
| Constructor Summary | |
|---|---|
ImprovedXMLListIterator(List<XMLElementInterface> list)
Construtor. |
|
ImprovedXMLListIterator(List<XMLElementInterface> list,
String tag)
Construtor. |
|
| Method Summary | |
|---|---|
String |
getTag()
Retorna a tag de referência para o iterador (o valor que será usado na comparação com os elementos da lista). |
boolean |
hasAny(String tag)
Indica se ainda há algum elemento com uma determinada tag. |
boolean |
hasAny(XMLElementInterface element)
Determina se a lista ainda possui o elemento em questão. |
boolean |
hasEnded()
Verifica se o percorrimento já terminou. |
boolean |
hasNext()
Indica se existe mais algum elemento na lista cuja tag seja igual à solicitada. |
int |
howManyLeft(String tag)
Retorna o número de instâncias de um determinado elemento na lista, a partir da posição corrente. |
int |
howManyLeft(XMLElementInterface element)
Retorna o número de instâncias de um determinado elemento na lista, a partir da posição corrente. |
boolean |
isNext(String tag)
Verifica se o próximo elemento é de um tipo específico, baseado em uma tag. |
XMLElementInterface |
next()
Retorna o próximo elemento com tipo igual ao que vínhamos buscando ou null caso não haja mais elementos deste tipo. |
XMLElementInterface |
next(String tag)
Obtém o próximo elemento da lista que possui a tag desejada, ou null caso não haja mais elementos com esta tag. Se a tag solicitada é a mesma que vínhamos buscando, simplesmente continuamos a iteração. |
void |
reset()
Reinicializa o iterador, usando a tag ANY como tag de busca. |
void |
reset(String tag)
Reinicializa o iterador, redefinindo a tag de busca. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ImprovedXMLListIterator(List<XMLElementInterface> list)
list - - lista de elementos coletados pelo parser
public ImprovedXMLListIterator(List<XMLElementInterface> list,
String tag)
list - - lista de elementos coletados pelo parsertag - - tag para percorrimento| Method Detail |
|---|
public void reset(String tag)
reset in interface XMLListIteratorInterfacetag - nova tag de buscapublic void reset()
reset in interface XMLListIteratorInterfacepublic XMLElementInterface next()
next in interface XMLListIteratorInterfacepublic XMLElementInterface next(String tag)
next in interface XMLListIteratorInterfacetag - nova tag de busca
public boolean hasNext()
hasNext in interface XMLListIteratorInterfacetrue se o elemento seguinte na lista possui tag
igual à tag de busca, false caso contrário.public String getTag()
getTag in interface XMLListIteratorInterfacepublic boolean hasAny(String tag)
Todos os elementos restantes são consultados, até que se encontre algum do tipo especificado ou se chegue ao fim da lista.
tag - - tag
public boolean hasAny(XMLElementInterface element)
Todos os elementos restantes são consultados, até que se encontre algum do tipo especificado ou se chegue ao fim da lista.
element - - elemento
hasAny(String)public int howManyLeft(XMLElementInterface element)
element - - elemento
public int howManyLeft(String tag)
tag - - tag do elemento
public boolean isNext(String tag)
tag - - tag
public boolean hasEnded()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||