// (c) MIT 2003.  All rights reserved.

// $Id: ElectedPoolBuilder.java,v 1.3 2003/03/06 00:40:48 moltmans Exp $
// Time-stamp: <2000-03-11 18:54:45 moltmans>
package rec.core;



import java.io.*;
import java.util.*;
import rec.util.*;
import rec.sys.*;
import rec.geo.*;

public class ElectedPoolBuilder extends PoolBuilder 
{
  public ElectedPoolBuilder()
  {
    super();
  }


  /**
   * Called by Surface on each relevant Recognizer.
   *
   * @param w   The last thing added to the Surface, the root Widget
   *     which caused recognition to begin again.
   * @param wp  The complete set of widgets in the Widget Pool
   * 
   */
  protected Collection findRelevantWidgets( Surface s, WidgetPool wp, 
					    Widget sw )
  {
    Collection relevant = new HashSet();      
      
    Iterator it = wp.iterator();

    while ( it.hasNext() ) {
      Widget w = (Widget)it.next();

      if ( w.isElected() ) {
	relevant.add( w );
      }
    }
    
    return relevant;
  }

}
