org.vectomatic.dom.svg
Class OMNodeList<T extends OMNode>

java.lang.Object
  extended by org.vectomatic.dom.svg.OMNodeList<T>
All Implemented Interfaces:
Iterable<T>

public class OMNodeList<T extends OMNode>
extends Object
implements Iterable<T>

Wrapper class for DOM NodeList

Author:
laaglu

Constructor Summary
protected OMNodeList(com.google.gwt.dom.client.NodeList<? extends com.google.gwt.dom.client.Node> nodeList)
          Constructor
 
Method Summary
 T getItem(int index)
          Returns the indexth item in the collection.
 int getLength()
          The number of nodes in the list.
 Iterator<T> iterator()
          Returns an iterator over the OMNode elements in this list in proper sequence.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OMNodeList

protected OMNodeList(com.google.gwt.dom.client.NodeList<? extends com.google.gwt.dom.client.Node> nodeList)
Constructor

Parameters:
nodeList - The wrapped node list
Method Detail

getItem

public final T getItem(int index)
Returns the indexth item in the collection. If index is greater than or equal to the number of nodes in the list, this returns null.

Parameters:
index - Index into the collection.
Returns:
The node at the indexth position in the NodeList, or null if that is not a valid index.

getLength

public final int getLength()
The number of nodes in the list. The range of valid child node indices is 0 to length-1 inclusive.


iterator

public Iterator<T> iterator()
Returns an iterator over the OMNode elements in this list in proper sequence.

This implementation returns a straightforward implementation of the iterator interface, relying on the backing list's getNumberOfItems(), and getItem(int) methods.

Note that the iterator returned by this method will throw an UnsupportedOperationException in response to its remove method.

Specified by:
iterator in interface Iterable<T extends OMNode>
Returns:
an iterator over the OMNode elements in this list in proper sequence


Copyright © 2012. All Rights Reserved.