kirk.io.sdl
Class SDLNormalElementIterator

java.lang.Object
  extended bykirk.io.sdl.SDLNormalElementIterator
All Implemented Interfaces:
Iterator

public class SDLNormalElementIterator
extends Object
implements Iterator

This class is an Iterator that iterates over an SDLNormalElement given a certain element type filter and optionally a name.

Version:
1
Author:
Berend "Kirk" Wouda

Field Summary
static int BOTH
          The element type identifier for both elements.
protected  int counter
          The element counter.
static int DATA_ELEMENT
          The element type identifier for data elements.
protected  SDLNormalElement element
          The element iterated over.
protected  int elementtype
          The internal (active) element type identifier.
protected  String name
          The name filtered upon.
static int NORMAL_ELEMENT
          The element type identifier for normal elements.
 
Constructor Summary
SDLNormalElementIterator(SDLNormalElement element)
          Constructs a new SDLNormalElementIterator working on the given SDLNormalElement.
SDLNormalElementIterator(SDLNormalElement element, int elementtype)
          Constructs a new SDLNormalElementIterator working on the given SDLNormalElement, filtering out all the ones of the given type.
SDLNormalElementIterator(SDLNormalElement element, String name, int elementtype)
          Constructs a new SDLNormalElementIterator working on the given SDLNormalElement, filtering out all the ones with the given name, and of the given type.
 
Method Summary
 boolean hasNext()
          Returns whether there is a next object to iterate to.
 Object next()
          Returns the next object and iterates onto it.
 void remove()
          Removes the current object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

element

protected SDLNormalElement element
The element iterated over.


name

protected String name
The name filtered upon.


elementtype

protected int elementtype
The internal (active) element type identifier.


counter

protected int counter
The element counter.


BOTH

public static final int BOTH
The element type identifier for both elements.

See Also:
Constant Field Values

NORMAL_ELEMENT

public static final int NORMAL_ELEMENT
The element type identifier for normal elements.

See Also:
Constant Field Values

DATA_ELEMENT

public static final int DATA_ELEMENT
The element type identifier for data elements.

See Also:
Constant Field Values
Constructor Detail

SDLNormalElementIterator

public SDLNormalElementIterator(SDLNormalElement element,
                                String name,
                                int elementtype)
                         throws IllegalArgumentException
Constructs a new SDLNormalElementIterator working on the given SDLNormalElement, filtering out all the ones with the given name, and of the given type.

Parameters:
element - The SDLNormalElement to iterate over.
name - The name to filter on.
elementtype - The type of element to filter on. Legal are SDLNormalElementIterator.BOTH, SDLNormalElementIterator.NORMAL_ELEMENT and SDLNormalElementIterator.DATA_ELEMENT.
Throws:
IllegalArgumentException - When the given element is null, or the given type is not a legal type.

SDLNormalElementIterator

public SDLNormalElementIterator(SDLNormalElement element,
                                int elementtype)
                         throws IllegalArgumentException
Constructs a new SDLNormalElementIterator working on the given SDLNormalElement, filtering out all the ones of the given type.

Parameters:
element - The SDLNormalElement to iterate over.
elementtype - The type of element to filter on. Legal are SDLNormalElementIterator.BOTH, SDLNormalElementIterator.NORMAL_ELEMENT and SDLNormalElementIterator.DATA_ELEMENT.
Throws:
IllegalArgumentException - When the given element is null, or the given type is not a legal type.

SDLNormalElementIterator

public SDLNormalElementIterator(SDLNormalElement element)
                         throws IllegalArgumentException
Constructs a new SDLNormalElementIterator working on the given SDLNormalElement.

Parameters:
element - The SDLNormalElement to iterate over.
Throws:
IllegalArgumentException - When the given element is null, or the given type is not a legal type.
Method Detail

hasNext

public boolean hasNext()
Returns whether there is a next object to iterate to.

Specified by:
hasNext in interface Iterator
Returns:
Whether there is a next object to iterate to.
See Also:
Iterator.hasNext()

next

public Object next()
            throws NoSuchElementException
Returns the next object and iterates onto it.

Specified by:
next in interface Iterator
Returns:
The next object and iterates onto it.
Throws:
NoSuchElementException - When there are no elements left to iterate to.
See Also:
Iterator.next()

remove

public void remove()
            throws UnsupportedOperationException,
                   IllegalStateException
Removes the current object. This method is not supported, as allowed by the Iterator interface.

Specified by:
remove in interface Iterator
Throws:
UnsupportedOperationException - If this method is not supported. Which it isn't.
IllegalStateException - If this object is not in the state to do this method.
See Also:
Iterator.remove()