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

package com.hypixel.hytale.procedurallib.property;

import javax.annotation.Nonnull;
import java.util.Arrays;

public class MinNoiseProperty implements NoiseProperty
{
    public static final double MIN_EPSILON = 1.0E-5;
    protected final NoiseProperty[] noiseProperties;
    
    public MinNoiseProperty(final NoiseProperty[] noiseProperties) {
        this.noiseProperties = noiseProperties;
    }
    
    public NoiseProperty[] getNoiseProperties() {
        return this.noiseProperties;
    }
    
    @Override
    public double get(final int seed, final double x, final double y) {
        double val = this.noiseProperties[0].get(seed, x, y);
        for (int i = 1; i < this.noiseProperties.length; ++i) {
            if (val < 1.0E-5) {
                return 0.0;
            }
            final double d;
            if (val > (d = this.noiseProperties[i].get(seed, x, y))) {
                val = d;
            }
        }
        return val;
    }
    
    @Override
    public double get(final int seed, final double x, final double y, final double z) {
        double val = this.noiseProperties[0].get(seed, x, y, z);
        for (int i = 1; i < this.noiseProperties.length; ++i) {
            if (val < 1.0E-5) {
                return 0.0;
            }
            final double d;
            if (val > (d = this.noiseProperties[i].get(seed, x, y, z))) {
                val = d;
            }
        }
        return val;
    }
    
    @Nonnull
    @Override
    public String toString() {
        return "MinNoiseProperty{noiseProperties=" + Arrays.toString(this.noiseProperties);
    }
}
