org.jboss.shotoku
Class NodeList

java.lang.Object
  extended by org.jboss.shotoku.NodeList
All Implemented Interfaces:
java.lang.Iterable<Node>, java.util.Collection<Node>

public class NodeList
extends java.lang.Object
implements java.util.Collection<Node>

A class representing a list of nodes and providing the possibility to manipulate these nodes.

Author:
Adam Warski (adamw@aster.pl), Damon Sicore (damon@sicore.com)

Constructor Summary
NodeList()
           
NodeList(java.util.List<Node> nodeList)
           
 
Method Summary
 boolean add(Node node)
          Adds the given node to the node list.
 boolean addAll(java.util.Collection<? extends Node> c)
           
 void addAll(NodeList list)
          Adds nodes from the given node list to this node list.
 void clear()
           
 boolean contains(java.lang.Object o)
           
 boolean containsAll(java.util.Collection<?> c)
           
 Node get(int i)
          Gets the i-th element of the list.
 boolean isEmpty()
           
 java.util.Iterator<Node> iterator()
           
 void limit(int limit)
          Limits the size of this node list.
 boolean remove(java.lang.Object o)
           
 boolean removeAll(java.util.Collection<?> c)
           
 boolean retainAll(java.util.Collection<?> c)
           
 int size()
           
 void sort(java.util.Comparator<Node> comparator)
          Sorts this node list with the given comparator.
 java.lang.Object[] toArray()
           
<T> T[]
toArray(T[] a)
           
 java.util.List<Node> toList()
          Gets an immutable java.util.List representation of this node list.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.Collection
equals, hashCode
 

Constructor Detail

NodeList

public NodeList()

NodeList

public NodeList(java.util.List<Node> nodeList)
Method Detail

add

public boolean add(Node node)
Adds the given node to the node list.

Specified by:
add in interface java.util.Collection<Node>
Parameters:
node - Node to add.

addAll

public void addAll(NodeList list)
Adds nodes from the given node list to this node list.

Parameters:
list - Node list to add.

sort

public void sort(java.util.Comparator<Node> comparator)
Sorts this node list with the given comparator.

Parameters:
comparator - Comparator to sort with.

toList

public java.util.List<Node> toList()
Gets an immutable java.util.List representation of this node list.

Returns:
An immutable java.util.List representation of this node list.

limit

public void limit(int limit)
Limits the size of this node list. After this operation, the size of this node list will be lower or equal to the given limit.

Parameters:
limit - Node count limit.

get

public Node get(int i)
Gets the i-th element of the list.

Parameters:
i - Index of the element to get.
Returns:
Node at the given index.

iterator

public java.util.Iterator<Node> iterator()
Specified by:
iterator in interface java.lang.Iterable<Node>
Specified by:
iterator in interface java.util.Collection<Node>

size

public int size()
Specified by:
size in interface java.util.Collection<Node>

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface java.util.Collection<Node>

contains

public boolean contains(java.lang.Object o)
Specified by:
contains in interface java.util.Collection<Node>

toArray

public java.lang.Object[] toArray()
Specified by:
toArray in interface java.util.Collection<Node>

toArray

public <T> T[] toArray(T[] a)
Specified by:
toArray in interface java.util.Collection<Node>

remove

public boolean remove(java.lang.Object o)
Specified by:
remove in interface java.util.Collection<Node>

containsAll

public boolean containsAll(java.util.Collection<?> c)
Specified by:
containsAll in interface java.util.Collection<Node>

addAll

public boolean addAll(java.util.Collection<? extends Node> c)
Specified by:
addAll in interface java.util.Collection<Node>

removeAll

public boolean removeAll(java.util.Collection<?> c)
Specified by:
removeAll in interface java.util.Collection<Node>

retainAll

public boolean retainAll(java.util.Collection<?> c)
Specified by:
retainAll in interface java.util.Collection<Node>

clear

public void clear()
Specified by:
clear in interface java.util.Collection<Node>


Copyright © -2006 . All Rights Reserved.