public static double considerEstimatedPreference ( final ErrorStrategy errorStrategy , final double recValue ) { boolean consider = true ; double v = recValue ; switch ( errorStrategy ) { default : case CONSIDER_EVERYTHING : break ; case NOT_CONSIDER_NAN : consider = ! Double . isNaN ( recValue ) ; break ; case CONSIDER_NAN_AS_0 : if ( Double . isNaN ( recValue ) ) { v = 0.0 ; } break ; case CONSIDER_NAN_AS_1 : if ( Double . isNaN ( recValue ) ) { v = 1.0 ; } break ; case CONSIDER_NAN_AS_3 : if ( Double . isNaN ( recValue ) ) { v = 3.0 ; } break ; } if ( consider ) { return v ; } else { return Double . NaN ; } }
Method that returns an estimated preference according to a given value and an error strategy .