/**
* Determine if two tuples are equal. Tuples are equal if they have the same
* arity and all of the elements are equal.
*
* @param o
* the tuple to compare to.
*
* @return true if the tuples have the same arity and all the elements are
* equal.
*/
public override bool Equals(Object o)
{
if (!(o is OtpErlangTuple))
{
return(false);
}
OtpErlangTuple t = (OtpErlangTuple)o;
int a = arity();
if (a != t.arity())
{
return(false);
}
for (int i = 0; i < a; i++)
{
if (!elems[i].Equals(t.elems[i]))
{
return(false); // early exit
}
}
return(true);
}