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

package it.unimi.dsi.fastutil.shorts;

import java.util.Objects;
import it.unimi.dsi.fastutil.SortedPair;
import java.io.Serializable;

public class ShortShortImmutableSortedPair extends ShortShortImmutablePair implements ShortShortSortedPair, Serializable
{
    private static final long serialVersionUID = 0L;
    
    private ShortShortImmutableSortedPair(final short left, final short right) {
        super(left, right);
    }
    
    public static ShortShortImmutableSortedPair of(final short left, final short right) {
        if (left <= right) {
            return new ShortShortImmutableSortedPair(left, right);
        }
        return new ShortShortImmutableSortedPair(right, left);
    }
    
    @Override
    public boolean equals(final Object other) {
        if (other == null) {
            return false;
        }
        if (other instanceof ShortShortSortedPair) {
            return this.left == ((ShortShortSortedPair)other).leftShort() && this.right == ((ShortShortSortedPair)other).rightShort();
        }
        return other instanceof SortedPair && Objects.equals(this.left, ((SortedPair)other).left()) && Objects.equals(this.right, ((SortedPair)other).right());
    }
    
    @Override
    public String toString() {
        return "{" + this.leftShort() + "," + this.rightShort() + "}";
    }
}
