private boolean rule6(double sample) {
        if (!hasMean()) {
            return false;
        }

        if (rule6LastFive.size() == 5) {
            switch (rule6LastFive.removeLast()) {
                case ">":
                    --rule6Above;
                    break;
                case "<":
                    --rule6Below;
                    break;
            }
        }

        if (Math.abs(sample - mean.getResult()) > oneDeviation) {
            if (sample > mean.getResult()) {
                ++rule6Above;
                rule6LastFive.push(">");
            } else {
                ++rule6Below;
                rule6LastFive.push("<");
            }
        } else {
            rule6LastFive.push("");
        }

        return rule6Above >= 4 || rule6Below >= 4;
    }
private boolean rule6 ( double sample ) { if ( ! hasMean ( ) ) { return false ; } if ( rule6LastFive . size ( ) == 5 ) { switch ( rule6LastFive . removeLast ( ) ) { case ">" : -- rule6Above ; break ; case "<" : -- rule6Below ; break ; } } if ( Math . abs ( sample - mean . getResult ( ) ) > oneDeviation ) { if ( sample > mean . getResult ( ) ) { ++ rule6Above ; rule6LastFive . push ( ">" ) ; } else { ++ rule6Below ; rule6LastFive . push ( "<" ) ; } } else { rule6LastFive . push ( "" ) ; } return rule6Above >= 4 || rule6Below >= 4 ; }
At least 4 of 5 points in a row are > 1 standard deviation from the mean in the same direction