org.opensha.commons.eq.cat.filters
Class ExtentsFilter

java.lang.Object
  extended by org.opensha.commons.eq.cat.filters.ExtentsFilter
All Implemented Interfaces:
CatalogFilter

public class ExtentsFilter
extends Object
implements CatalogFilter

This class filters catalogs based on space,time and magnitude parameters. Filter assumes that catalogs subjected to processing are sorted ascending by date. Any constructor arguments can be null. TODO do range checking and throw exceptions TODO check and add documentation for range searching; I believe it's currently >=min & <=max (i.e. inclusive)

Version:
$Id: ExtentsFilter.java 7478 2011-02-15 04:56:25Z pmpowers $
Author:
Peter Powers

Field Summary
 
Fields inherited from interface org.opensha.commons.eq.cat.filters.CatalogFilter
FILTER_ERROR, FILTER_ERROR_NO_RESULT, FILTER_STATUS_IDLE, FILTER_STATUS_WORKING
 
Constructor Summary
ExtentsFilter()
          Constructs an empty filter that will produce no results.
 
Method Summary
 int[] process(MutableCatalog catalog)
          Processes a given MutableCatalog against a filter.
 ExtentsFilter setDates(long min, long max)
          Sets date filter criteria.
 ExtentsFilter setDepths(double min, double max)
          Sets depth filter criteria.
 ExtentsFilter setLatitudes(double min, double max)
          Sets latitude filter criteria.
 ExtentsFilter setLongitudes(double min, double max)
          Sets longitude filter criteria.
 ExtentsFilter setMagnitudes(double min, double max)
          Sets magnitude filter criteria.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ExtentsFilter

public ExtentsFilter()
Constructs an empty filter that will produce no results.

Method Detail

setLatitudes

public ExtentsFilter setLatitudes(double min,
                                  double max)
Sets latitude filter criteria.

Parameters:
min - minimum latitude
max - maximum latitude
Returns:
a reference to this filter for method chaining

setLongitudes

public ExtentsFilter setLongitudes(double min,
                                   double max)
Sets longitude filter criteria.

Parameters:
min - minimum longitude
max - maximum longitude
Returns:
a reference to this filter for method chaining

setDepths

public ExtentsFilter setDepths(double min,
                               double max)
Sets depth filter criteria.

Parameters:
min - minimum depth
max - maximum depth
Returns:
a reference to this filter for method chaining

setMagnitudes

public ExtentsFilter setMagnitudes(double min,
                                   double max)
Sets magnitude filter criteria.

Parameters:
min - minimum magnitude
max - maximum magnitude
Returns:
a reference to this filter for method chaining

setDates

public ExtentsFilter setDates(long min,
                              long max)
Sets date filter criteria.

Parameters:
min - minimum date/time (UTC)
max - maximum date/time (UTC)
Returns:
a reference to this filter for method chaining

process

public int[] process(MutableCatalog catalog)
Description copied from interface: CatalogFilter
Processes a given MutableCatalog against a filter. Returns an array of valid event indices. Returns null if filter produces no results.

Specified by:
process in interface CatalogFilter
Parameters:
catalog - to process
Returns:
array of event indices