View Javadoc

1   /*
2    * $Id: IComponentIterator.java,v 1.18 2011/06/16 09:29:40 jbmeslin Exp $
3    * 
4    */
5   package org.rcfaces.core.component.iterator;
6   
7   import java.util.NoSuchElementException;
8   
9   import javax.faces.component.UIComponent;
10  
11  /**
12   * An iterator over a collection of UIComponents.
13   * 
14   * @author Olivier Oeuillot (latest modification by $Author: jbmeslin $)
15   * @version $Revision: 1.18 $ $Date: 2011/06/16 09:29:40 $
16   */
17  public interface IComponentIterator {
18  
19      /**
20       * Returns the number of components in this list.
21       * 
22       * @return the number of components in this list.
23       */
24      int count();
25  
26      /**
27       * Returns <tt>true</tt> if the iteration has more components. (In other
28       * words, returns <tt>true</tt> if <tt>next</tt> would return an element
29       * rather than throwing an exception.)
30       * 
31       * @return <tt>true</tt> if the iterator has more components.
32       */
33      boolean hasNext();
34  
35      /**
36       * Returns the next component in the iteration. Calling this method
37       * repeatedly until the {@link #hasNext()} method returns false will return
38       * each element in the underlying collection exactly once.
39       * 
40       * @return the next component in the iteration.
41       * @exception NoSuchElementException
42       *                iteration has no more component.
43       */
44      UIComponent nextComponent();
45  
46      /**
47       * Returns an array containing all of the components in this list in proper
48       * sequence; the runtime type of the returned array is that of the specified
49       * array.
50       * 
51       * @param array
52       *            the array into which the components of this list are to be
53       *            stored, if it is big enough; otherwise, a new array of the
54       *            same runtime type is allocated for this purpose.
55       * @return an array containing the components of this list.
56       * 
57       * @throws ArrayStoreException
58       *             if the runtime type of the specified array is not a supertype
59       *             of the runtime type of every component in this list.
60       * @throws NullPointerException
61       *             if the specified array is <tt>null</tt>.
62       */
63      UIComponent[] toArray(UIComponent[] array);
64  }