示例#1
0
    public static long ComputeMembraneDataHash(this IComputedMembraneData data)
    {
        var positions = data.OrganellePositions;

        unchecked
        {
            var  nameHash = data.Type.InternalName.GetHashCode();
            long hash     = 1409 + nameHash + ((long)nameHash << 28);

            hash ^= (positions.Count + 1) * 7793;
            int hashMultiply = 1;

            foreach (var position in positions)
            {
                var posHash = position.GetHashCode();
                hash ^= (hashMultiply * posHash) ^ ((5081L * hashMultiply * hashMultiply + posHash) << 32);
                ++hashMultiply;
            }

            return(hash);
        }
    }
示例#2
0
 public static bool MembraneDataFieldsEqual(this IComputedMembraneData data, IComputedMembraneData other)
 {
     return(data.Type.Equals(other.Type) && data.OrganellePositions.SequenceEqual(other.OrganellePositions));
 }