class AnomalyClassifier {

    public AnomalyLevel classify(AnomalyThresholds thresholds, double observed) {
        notNull(thresholds, "thresholds can't be null");

        val checkUpper = (anomalyType == AnomalyType.RIGHT_TAILED || anomalyType == AnomalyType.TWO_TAILED);
        val checkLower = (anomalyType == AnomalyType.LEFT_TAILED || anomalyType == AnomalyType.TWO_TAILED);

        val upperStrong = thresholds.getUpperStrong();
        val upperWeak = thresholds.getUpperWeak();
        val lowerWeak = thresholds.getLowerWeak();
        val lowerStrong = thresholds.getLowerStrong();

        if (checkUpper) {
            if (upperStrong != null && observed > upperStrong) {
                return AnomalyLevel.STRONG;
            } else if (upperWeak != null && observed > upperWeak) {
                return AnomalyLevel.WEAK;
            }
        }

        if (checkLower) {
            if (lowerStrong != null && observed < lowerStrong) {
                return AnomalyLevel.STRONG;
            } else if (lowerWeak != null && observed < lowerWeak) {
                return AnomalyLevel.WEAK;
            }
        }

        return AnomalyLevel.NORMAL;
    }

}