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

package com.hypixel.hytale.common.tuple;

import javax.annotation.Nullable;
import javax.annotation.Nonnull;

public class BoolDoublePair implements Comparable<BoolDoublePair>
{
    private final boolean left;
    private final double right;
    
    public BoolDoublePair(final boolean left, final double right) {
        this.left = left;
        this.right = right;
    }
    
    public final boolean getKey() {
        return this.getLeft();
    }
    
    public boolean getLeft() {
        return this.left;
    }
    
    public final double getValue() {
        return this.getRight();
    }
    
    public double getRight() {
        return this.right;
    }
    
    @Override
    public int compareTo(@Nonnull final BoolDoublePair other) {
        final int compare = Boolean.compare(this.left, other.left);
        if (compare != 0) {
            return compare;
        }
        return Double.compare(this.right, other.right);
    }
    
    @Override
    public boolean equals(@Nullable final Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || this.getClass() != o.getClass()) {
            return false;
        }
        final BoolDoublePair that = (BoolDoublePair)o;
        return this.left == that.left && Double.compare(that.right, this.right) == 0;
    }
    
    @Override
    public int hashCode() {
        int result = this.left ? 1 : 0;
        final long temp = Double.doubleToLongBits(this.right);
        result = 31 * result + (int)(temp ^ temp >>> 32);
        return result;
    }
    
    @Nonnull
    @Override
    public String toString() {
        return "(" + this.getLeft() + "," + this.getRight();
    }
    
    @Nonnull
    public String toString(@Nonnull final String format) {
        return String.format(format, this.getLeft(), this.getRight());
    }
    
    @Nonnull
    public static BoolDoublePair of(final boolean left, final double right) {
        return new BoolDoublePair(left, right);
    }
}
