View Javadoc

    1   package baseCode.dataFilter;
    2
    3   import java.lang.reflect.Constructor;
    4
    5   import org.apache.commons.logging.Log;
    6   import org.apache.commons.logging.LogFactory;
    7
    8   import baseCode.dataStructure.matrix.NamedMatrix;
    9
    10  /***
    11   * Base implementation of the filter class. Subclasses must implement the filter() method.
    12   * <p>
    13   * Copyright (c) 2004 Columbia University
    14   * </p>
    15   *
    16   * @author Paul Pavlidis
    17   * @version $Id: AbstractFilter.java,v 1.11 2004/07/27 03:18:58 pavlidis Exp $
    18   */
    19
    20  public abstract class AbstractFilter implements Filter {
    21
    22     protected static final Log log = LogFactory.getLog( AbstractFilter.class );
    23
    24     protected NamedMatrix getOutputMatrix( NamedMatrix data, int numRows,
    25           int numCols ) {
    26        NamedMatrix returnval = null;
    27
    28        Constructor cr;
    29        try {
    30           cr = data.getClass().getConstructor( new Class[] {
    31                 int.class, int.class
    32           } );
    33           returnval = ( NamedMatrix ) cr.newInstance( new Object[] {
    34                 new Integer( numRows ), new Integer( numCols )
    35           } );
    36        } catch ( Exception e ) {
    37           e.printStackTrace();
    38        }
    39
    40        return returnval;
    41     }
    42
    43  }