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

////////////////////////////////////////////////////////////////////////////////
//
// FILE:	Region.java
//
// AUTHOR:	Manoj D. Muzumdar
//		archon@ai.mit.edu
//
// DATE:	06-XX-98
//
// COPYRIGHT:	Massachusetts Institute of Technology
//		All rights reserved.
//
// PURPOSE:	Location approximation
//
// HISTORY:     11-15-98 archon
//              Now aware of new rec.geo package
//              Made mutable
//
////////////////////////////////////////////////////////////////////////////////

package rec.loc;

import java.util.*;
import java.awt.*;
import rec.util.*;
import rec.geo.*;

public class Region extends Slice
{
  public Region( GPoint center, double outerRadius )
  {
    super( new Space( center, outerRadius ) );
  }

  public Region( GPoint center, double outerRadius,
		 double beginDegree, double endDegree )
  {
    super( new Space( center, outerRadius ),
	   beginDegree, endDegree );
  }

  public Region( GPoint center, double innerRadius,
		 double outerRadius )
  {
    super( new Space( center, innerRadius, outerRadius ) );
  }

  public Region( GPoint center, double innerRadius,
		 double outerRadius, double beginDegree,
		 double endDegree )
  {
    super( new Space( center, innerRadius, outerRadius ),
	   beginDegree, endDegree );
  }

  public Region( Region r )
  {
    super( r.getSpace(), r.getBeginDegree(), r.getEndDegree() );
  }

  //////////////////////////////////////////////////////////////////////////////

  /**
   * Filters out only the Locatable's that are in the Region.
   *
   * @param e  An Iterator of Locatable's.
   */
  public Iterator filter( Iterator e )
  {
    if( e == null )
      return( null );

    Vector v = new Vector();

    while( e.hasNext() ) {

      Locatable l = (Locatable)e.next();
      if( contains( l ) )
	v.addElement( l );
    }

    return( v.iterator() );
  }
}

////////////////////////////////////////////////////////////////////////////////
