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

package com.hypixel.hytale.builtin.hytalegenerator.rangemaps;

import javax.annotation.Nonnull;

public class DoubleRange
{
    private double min;
    private double max;
    private boolean inclusiveMin;
    private boolean inclusiveMax;
    
    public DoubleRange(final double min, final boolean inclusiveMin, final double max, final boolean inclusiveMax) {
        if (min > max) {
            throw new IllegalArgumentException("min greater than max");
        }
        this.min = min;
        this.max = max;
        this.inclusiveMin = inclusiveMin;
        this.inclusiveMax = inclusiveMax;
    }
    
    public double getMin() {
        return this.min;
    }
    
    public boolean isInclusiveMin() {
        return this.inclusiveMin;
    }
    
    public double getMax() {
        return this.max;
    }
    
    public boolean isInclusiveMax() {
        return this.inclusiveMax;
    }
    
    public boolean includes(final double v) {
        if (this.inclusiveMin) {
            if (v < this.min) {
                return false;
            }
        }
        else if (v <= this.min) {
            return false;
        }
        if (this.inclusiveMax ? (v <= this.max) : (v < this.max)) {
            return true;
        }
        return false;
    }
    
    @Nonnull
    public static DoubleRange inclusive(final double min, final double max) {
        return new DoubleRange(min, true, max, true);
    }
    
    @Nonnull
    public static DoubleRange exclusive(final double min, final double max) {
        return new DoubleRange(min, false, max, false);
    }
}
