using System.Collections.Generic;
namespace LibGit2Sharp.Core.Compat
{
///
/// Represents a 2-tuple, or pair.
///
/// The type of the tuple's first component.
/// The type of the tuple's second component.
public class Tuple
{
private readonly KeyValuePair kvp;
///
/// Initializes a new instance of the class.
///
/// The value of the tuple's first component.
/// The value of the tuple's second component.
public Tuple(T1 item1, T2 item2)
{
kvp = new KeyValuePair(item1, item2);
}
///
/// Gets the value of the current object's second component.
///
public T2 Item2
{
get { return kvp.Value; }
}
///
/// Gets the value of the current object's first component.
///
public T1 Item1
{
get { return kvp.Key; }
}
///
/// Returns the hash code for the current object.
///
/// A 32-bit signed integer hash code.
public override int GetHashCode()
{
return kvp.GetHashCode();
}
///
/// Returns a value that indicates whether the current object is equal to a specified object.
///
/// The object to compare with this instance.
/// true if the current instance is equal to the specified object; otherwise, false.
public override bool Equals(object obj)
{
if (!(obj is Tuple))
{
return false;
}
return kvp.Equals(((Tuple)obj).kvp);
}
}
}