Clover coverage report - baseCode - 0.2.5 Coverage timestamp: Tue Apr 12 2005 11:31:58 EDT FRAMES NO FRAMES |
file stats: | LOC: | 49 |  | Methods: | 1
| NCLOC: | 30 |  | Classes: | 1
30 day Evaluation Version distributed via the Maven Jar Repository. Clover is not free. You have 30 days to evaluate it. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover
Source file | Conditionals | Statements | Methods | TOTAL
ItemLevelFilter.java | 80% | 82.4% | 100% | 82.1% |

1 |  |
     package baseCode.dataFilter;
2 |  |
3 |  |
     import baseCode.dataStructure.matrix.DenseDoubleMatrix2DNamed;
4 |  |
     import baseCode.dataStructure.matrix.NamedMatrix;
5 |  |
6 |  |
     /**
7 |  |
      * Filter that remove individual values that are outside of a range. Removed values are set to NaN.
8 |  |
      * <p>
9 |  |
      * Copyright (c) 2004 Columbia University
10 |  |
      *
11 |  |
      * @author Pavlidis
12 |  |
      * @version $Id: ItemLevelFilter.java,v 1.5 2004/07/27 03:18:58 pavlidis Exp $
13 |  |
      */
14 |  |
     public class ItemLevelFilter extends AbstractLevelFilter {
15 |  |
16 | 1 |
        public NamedMatrix filter( NamedMatrix data ) {
17 | 1 |
           if ( !( data instanceof DenseDoubleMatrix2DNamed ) ) {
18 | 0 |
              throw new IllegalArgumentException(
19 |  |
                    "Only valid for DenseDoubleMatrix2DNamed" );
20 |  |
           }
21 |  |
22 | 1 |
           if ( lowCut == -Double.MAX_VALUE && highCut == Double.MAX_VALUE ) {
23 | 0 |
              log.info( "No filtering requested" );
24 | 0 |
              return data;
25 |  |
           }
26 |  |
27 | 1 |
           int numRows = data.rows();
28 | 1 |
           int numCols = data.columns();
29 | 1 |
           DenseDoubleMatrix2DNamed returnval = new DenseDoubleMatrix2DNamed(
30 |  |
                 numRows, numCols );
31 | 1 |
           for ( int i = 0; i < numRows; i++ ) {
32 |  |
33 | 30 |
              for ( int j = 0; j < numCols; j++ ) {
34 |  |
35 | 360 |
                 double newVal = ( ( DenseDoubleMatrix2DNamed ) data ).get( i, j );
36 | 360 |
                 if ( newVal < lowCut || newVal > highCut ) {
37 | 77 |
                    newVal = Double.NaN;
38 |  |
                 }
39 |  |
40 | 360 |
                 returnval.set( i, j, newVal );
41 |  |
              }
42 |  |
           }
43 | 1 |
           returnval.setColumnNames( data.getColNames() );
44 | 1 |
           returnval.setRowNames( data.getRowNames() );
45 |  |
46 | 1 |
           return returnval;
47 |  |
        }
48 |  |
49 |  |
     }