// 
// Decompiled by Procyon v0.6.0
// 

package com.hypixel.hytale.common.benchmark;

public class ContinuousValueRecorder
{
    protected double minValue;
    protected double maxValue;
    protected double sumValues;
    protected long count;
    
    public ContinuousValueRecorder() {
        this.minValue = Double.MAX_VALUE;
        this.maxValue = -1.7976931348623157E308;
        this.sumValues = 0.0;
        this.count = 0L;
    }
    
    public void reset() {
        this.minValue = Double.MAX_VALUE;
        this.maxValue = -1.7976931348623157E308;
        this.sumValues = 0.0;
        this.count = 0L;
    }
    
    public double getMinValue(final double def) {
        return (this.count > 0L) ? this.minValue : def;
    }
    
    public double getMinValue() {
        return this.getMinValue(0.0);
    }
    
    public double getMaxValue(final double def) {
        return (this.count > 0L) ? this.maxValue : def;
    }
    
    public double getMaxValue() {
        return this.getMaxValue(0.0);
    }
    
    public long getCount() {
        return this.count;
    }
    
    public double getAverage(final double def) {
        return (this.count > 0L) ? (this.sumValues / this.count) : def;
    }
    
    public double getAverage() {
        return this.getAverage(0.0);
    }
    
    public double record(final double value) {
        if (this.minValue > value) {
            this.minValue = value;
        }
        if (this.maxValue < value) {
            this.maxValue = value;
        }
        ++this.count;
        this.sumValues += value;
        return value;
    }
}
