本文整理汇总了C#中IPersistentVector.GetHashCode方法的典型用法代码示例。如果您正苦于以下问题:C# IPersistentVector.GetHashCode方法的具体用法?C# IPersistentVector.GetHashCode怎么用?C# IPersistentVector.GetHashCode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IPersistentVector
的用法示例。
在下文中一共展示了IPersistentVector.GetHashCode方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: doEquals
/// <summary>
/// Compares an <see cref="IPersistentVector">IPersistentVector</see> to another object for equality.
/// </summary>
/// <param name="v">The <see cref="IPersistentVector">IPersistentVector</see> to compare.</param>
/// <param name="obj">The other object to compare.</param>
/// <returns><value>true</value> if the specified Object is equal to the current Object;
/// otherwise, <value>false</value>.
/// </returns>
public static bool doEquals(IPersistentVector v, object obj)
{
if (obj is IList || obj is IPersistentVector)
{
IList ma = obj as IList;
if (ma.Count != v.count() || ma.GetHashCode() != v.GetHashCode())
return false;
for (int i = 0; i < v.count(); i++)
{
if (!Util.equals(v.nth(i), ma[i]))
return false;
}
return true;
}
else
{
if (!(obj is Sequential))
return false;
ISeq ms = RT.seq(obj);
for (int i = 0; i < v.count(); i++, ms = ms.next())
{
if (ms == null || !Util.equals(v.nth(i), ms.first()))
return false;
}
if (ms != null)
return false;
}
return true;
}
示例2: doEquals
/// <summary>
/// Compares an <see cref="IPersistentVector">IPersistentVector</see> to another object for equality.
/// </summary>
/// <param name="v">The <see cref="IPersistentVector">IPersistentVector</see> to compare.</param>
/// <param name="obj">The other object to compare.</param>
/// <returns><value>true</value> if the specified Object is equal to the current Object;
/// otherwise, <value>false</value>.
/// </returns>
public static bool doEquals(IPersistentVector v, object obj)
{
if ( obj is IList || obj is IPersistentVector )
{
IList ma = obj as IList;
if (ma.Count != v.count() || ma.GetHashCode() != v.GetHashCode())
return false;
for ( int i=0; i<v.count(); i++ )
{
if (!Util.equals(v.nth(i), ma[i]))
return false;
}
return true;
}
// Example in original code of Sequential/IPersistentVector conflation.
//if(!(obj instanceof Sequential))
// return false;
// ISeq ms = ((IPersistentCollection) obj).seq();
// for(int i = 0; i < v.count(); i++, ms = ms.rest())
// {
// if(ms == null || !Util.equals(v.nth(i), ms.first()))
// return false;
// }
// if(ms != null)
// return false;
// }
//return true;
ISeq ms = obj as ISeq;
if (ms == null)
{
IPersistentCollection mc = obj as IPersistentCollection;
if (mc == null)
return false;
ms = mc.seq();
}
// Once we have the ISeq, we're ready to go.
for (int i = 0; i < v.count(); i++, ms = ms.rest())
{
if (ms == null || !Util.equals(v.nth(i), ms.first()))
return false;
}
if (ms != null)
return false;
return true;
}