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

java.lang.Object
  extended by org.opensha.commons.eq.cat.filters.CatalogBrush

public class CatalogBrush
extends Object

This class may be used to efficiently brush catalog data. Specifically, the following DataTypes can be filtered using min-max constraints: [ TIME, LATITUDE,LONGITUDE, DEPTH, MAGNITUDE ] For large catalogs it has a significant memory footprint once instantiated because it internally manages index arrays and sorted copies of catalog source data arrays.

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

Nested Class Summary
static class CatalogBrush.LimitKey
          Key used to identify whether DataBrush should adjust a minimum or a maximum value.
static class CatalogBrush.SelectionChange
          Identifies a type of selection change.
 
Constructor Summary
CatalogBrush(MutableCatalog catalog)
          Initializes a new data brush with the supplied catalog.
 
Method Summary
 CatalogBrush.SelectionChange adjust(CatalogBrush.LimitKey key, long value)
           
 CatalogBrush.SelectionChange adjust(DataType type, CatalogBrush.LimitKey key, double newValue)
          Adjusts the catalog selection and returns a flag describing the change.
 BitSet selection()
          Returns the current selection as a BitSet.
 BitSet selectionChange()
          Returns the current selection change as a BitSet.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CatalogBrush

public CatalogBrush(MutableCatalog catalog)
Initializes a new data brush with the supplied catalog.

Parameters:
catalog -
Method Detail

selection

public BitSet selection()
Returns the current selection as a BitSet.

Returns:
the current selection

selectionChange

public BitSet selectionChange()
Returns the current selection change as a BitSet.

Returns:
the current selection change

adjust

public CatalogBrush.SelectionChange adjust(CatalogBrush.LimitKey key,
                                           long value)

adjust

public CatalogBrush.SelectionChange adjust(DataType type,
                                           CatalogBrush.LimitKey key,
                                           double newValue)
Adjusts the catalog selection and returns a flag describing the change. If the DataType supplied is not applicable for the associated catalog, the supplied value is out of range for the the DataType, or the selection hasn't changed, SelectionChange.NONE is returned. Otherwise method returns SelectionChange.ADD or SelectionChange.REMOVE. Once method returns, the BitSet returned by selectionChange() represents the change.

Parameters:
type - of data to adjust
key - to adjust - min or max limit
newValue - for limit
Returns:
true if catalog selection has changed, false otherwise