class EdmxDetector implements BreakoutDetector {

    @Override
    public DetectorResult detect(MetricData metricData) {
        notNull(metricData, "metricData can't be null");
        buffer.add(metricData);

        val warmup = buffer.remainingCapacity() > 0;
        val result = new EdmxDetectorResult().setWarmup(warmup);
        val trusted = isTrusted();

        if (warmup) {
            log.info("EdmxDetector warming up: uuid={}, size={}, toGo={}, metricData={}",
                    uuid, buffer.size(), buffer.remainingCapacity(), metricData);
            return result;
        }

        val mdValues = buffer.stream().mapToDouble(md -> md.getValue()).toArray();
        val estimate = EdmxEstimator.estimate(
                mdValues,
                hyperparams.getDelta(),
                hyperparams.getNumPerms());

        val mdList = buffer.stream().collect(Collectors.toList());
        val location = estimate.getLocation();

        if (location == -1) {
            return result;
        }

        val epochSeconds = mdList.get(location).getTimestamp();
        val instant = epochSecondToInstant(epochSeconds);
        val anomalyLevel = calculateAnomalyLevel(estimate);

        return result
                .setTimestamp(instant)
                .setEdmxEstimate(estimate)
                .setAnomalyLevel(anomalyLevel)
                .setTrusted(trusted);
    }

    public  EdmxDetector(UUID uuid, EdmxHyperparams hyperparams, boolean trusted);

}