|
|||||||||||||||||||
| 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 | |||||||||||||||
| AbstractLevelFilter.java | 75% | 81.2% | 85.7% | 81.5% |
|
||||||||||||||
| 1 |
package baseCode.dataFilter;
|
|
| 2 |
|
|
| 3 |
import baseCode.math.Stats;
|
|
| 4 |
|
|
| 5 |
/**
|
|
| 6 |
* Abstract class representing a filter that removes things from matrices based on the values themselves. Copyright (c)
|
|
| 7 |
* 2004 Columbia University
|
|
| 8 |
*
|
|
| 9 |
* @author Owner
|
|
| 10 |
* @version $Id: AbstractLevelFilter.java,v 1.3 2004/07/27 03:18:58 pavlidis Exp $
|
|
| 11 |
*/
|
|
| 12 |
public abstract class AbstractLevelFilter extends AbstractFilter { |
|
| 13 |
|
|
| 14 |
protected double lowCut = -Double.MAX_VALUE; |
|
| 15 |
protected double highCut = Double.MAX_VALUE; |
|
| 16 |
protected boolean useLowAsFraction = false; |
|
| 17 |
protected boolean useHighAsFraction = false; |
|
| 18 |
|
|
| 19 |
/**
|
|
| 20 |
* Set the low threshold for removal.
|
|
| 21 |
*
|
|
| 22 |
* @param lowCut the threshold
|
|
| 23 |
*/
|
|
| 24 | 17 |
public void setLowCut( double lowCut ) { |
| 25 | 17 |
this.lowCut = lowCut;
|
| 26 |
} |
|
| 27 |
|
|
| 28 |
/**
|
|
| 29 |
* @param lowCut
|
|
| 30 |
* @param isFraction
|
|
| 31 |
*/
|
|
| 32 | 16 |
public void setLowCut( double lowCut, boolean isFraction ) { |
| 33 | 16 |
setLowCut( lowCut ); |
| 34 | 16 |
setUseLowCutAsFraction( isFraction ); |
| 35 | 15 |
useLowAsFraction = isFraction; |
| 36 |
} |
|
| 37 |
|
|
| 38 |
/**
|
|
| 39 |
* Set the high threshold for removal. If not set, no filtering will occur.
|
|
| 40 |
*
|
|
| 41 |
* @param h the threshold
|
|
| 42 |
*/
|
|
| 43 | 11 |
public void setHighCut( double h ) { |
| 44 | 11 |
highCut = h; |
| 45 |
} |
|
| 46 |
|
|
| 47 |
/**
|
|
| 48 |
* @param highCut
|
|
| 49 |
* @param isFraction
|
|
| 50 |
*/
|
|
| 51 | 11 |
public void setHighCut( double highCut, boolean isFraction ) { |
| 52 | 11 |
setHighCut( highCut ); |
| 53 | 11 |
setUseHighCutAsFraction( isFraction ); |
| 54 | 11 |
useHighAsFraction = isFraction; |
| 55 |
} |
|
| 56 |
|
|
| 57 |
/**
|
|
| 58 |
* @param setting
|
|
| 59 |
*/
|
|
| 60 | 11 |
public void setUseHighCutAsFraction( boolean setting ) { |
| 61 | 11 |
if ( setting == true && !Stats.isValidFraction( highCut ) ) { |
| 62 | 0 |
throw new IllegalArgumentException( |
| 63 |
"Value for cut(s) are invalid for using "
|
|
| 64 |
+ "as fractions, must be >0.0 and <1.0," );
|
|
| 65 |
} |
|
| 66 | 11 |
useHighAsFraction = setting; |
| 67 |
} |
|
| 68 |
|
|
| 69 |
/**
|
|
| 70 |
* @param setting
|
|
| 71 |
*/
|
|
| 72 | 16 |
public void setUseLowCutAsFraction( boolean setting ) { |
| 73 | 16 |
if ( setting == true && !Stats.isValidFraction( lowCut ) ) { |
| 74 | 1 |
throw new IllegalArgumentException( |
| 75 |
"Value for cut(s) are invalid for using "
|
|
| 76 |
+ "as fractions, must be >0.0 and <1.0," );
|
|
| 77 |
} |
|
| 78 | 15 |
useLowAsFraction = setting; |
| 79 |
} |
|
| 80 |
|
|
| 81 |
/**
|
|
| 82 |
* Set the filter to interpret the low and high cuts as fractions; that is, if true, lowcut 0.1 means remove 0.1 of
|
|
| 83 |
* the rows with the lowest values. Otherwise the cuts are interpeted as actual values. Default = false.
|
|
| 84 |
*
|
|
| 85 |
* @param setting boolean
|
|
| 86 |
*/
|
|
| 87 | 0 |
public void setUseAsFraction( boolean setting ) { |
| 88 | 0 |
setUseHighCutAsFraction( setting ); |
| 89 | 0 |
setUseLowCutAsFraction( setting ); |
| 90 |
} |
|
| 91 |
|
|
| 92 |
} |
|
||||||||||