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

package it.unimi.dsi.fastutil.chars;

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

public class CharCharImmutableSortedPair extends CharCharImmutablePair implements CharCharSortedPair, Serializable
{
    private static final long serialVersionUID = 0L;
    
    private CharCharImmutableSortedPair(final char left, final char right) {
        super(left, right);
    }
    
    public static CharCharImmutableSortedPair of(final char left, final char right) {
        if (left <= right) {
            return new CharCharImmutableSortedPair(left, right);
        }
        return new CharCharImmutableSortedPair(right, left);
    }
    
    @Override
    public boolean equals(final Object other) {
        if (other == null) {
            return false;
        }
        if (other instanceof CharCharSortedPair) {
            return this.left == ((CharCharSortedPair)other).leftChar() && this.right == ((CharCharSortedPair)other).rightChar();
        }
        return other instanceof SortedPair && Objects.equals(this.left, ((SortedPair)other).left()) && Objects.equals(this.right, ((SortedPair)other).right());
    }
    
    @Override
    public String toString() {
        return "{" + this.leftChar() + "," + this.rightChar() + "}";
    }
}
