package com.atmob.voiceai.utils;

import android.util.Pair;

import java.util.Objects;

public class ThreePair<F, S, T> {

    public final F first;
    public final S second;
    public final T third;

    public ThreePair(F first, S second, T third) {
        this.first = first;
        this.second = second;
        this.third = third;
    }

    @Override
    public boolean equals(Object o) {
        if (!(o instanceof Pair)) {
            return false;
        }
        Pair<?, ?> p = (Pair<?, ?>) o;
        return Objects.equals(p.first, first) && Objects.equals(p.second, second) && Objects.equals(p.second, third);
    }

    @Override
    public int hashCode() {
        return (first == null ? 0 : first.hashCode()) ^ (second == null ? 0 : second.hashCode()) ^ (third == null ? 0 : third.hashCode());
    }

    @Override
    public String toString() {
        return "Pair{" + String.valueOf(first) + " " + String.valueOf(second) + " " + String.valueOf(third) + "}";
    }

    public static <A, B, C> ThreePair<A, B, C> create(A a, B b, C c) {
        return new ThreePair<A, B, C>(a, b, c);
    }
}
