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

package com.hypixel.hytale.builtin.hytalegenerator.density.nodes;

import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import com.hypixel.hytale.builtin.hytalegenerator.density.Density;

public class PowDensity extends Density
{
    private final double exponent;
    @Nullable
    private Density input;
    
    public PowDensity(final double exponent, final Density input) {
        this.exponent = exponent;
        this.input = input;
    }
    
    @Override
    public double process(@Nonnull final Context context) {
        if (this.input == null) {
            return 0.0;
        }
        final double value = this.input.process(context);
        if (value < 0.0) {
            return -Math.pow(-value, this.exponent);
        }
        return Math.pow(value, this.exponent);
    }
    
    @Override
    public void setInputs(@Nonnull final Density[] inputs) {
        if (inputs.length == 0) {
            this.input = null;
        }
        this.input = inputs[0];
    }
}
