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

package com.hypixel.hytale.common.tuple;

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

public class BoolIntPair implements Comparable<BoolIntPair>
{
    private final boolean left;
    private final int right;
    
    public BoolIntPair(final boolean left, final int right) {
        this.left = left;
        this.right = right;
    }
    
    public final boolean getKey() {
        return this.getLeft();
    }
    
    public boolean getLeft() {
        return this.left;
    }
    
    public final int getValue() {
        return this.getRight();
    }
    
    public int getRight() {
        return this.right;
    }
    
    @Override
    public int compareTo(@Nonnull final BoolIntPair other) {
        final int compare = Boolean.compare(this.left, other.left);
        if (compare != 0) {
            return compare;
        }
        return Integer.compare(this.right, other.right);
    }
    
    @Override
    public int hashCode() {
        int result = this.left ? 1 : 0;
        result = 31 * result + this.right;
        return result;
    }
    
    @Override
    public boolean equals(@Nullable final Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || this.getClass() != o.getClass()) {
            return false;
        }
        final BoolIntPair that = (BoolIntPair)o;
        return this.left == that.left && this.right == that.right;
    }
    
    @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 BoolIntPair of(final boolean left, final int right) {
        return new BoolIntPair(left, right);
    }
}
