Esempio n. 1
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (HasClubId)
            {
                hash ^= ClubId.GetHashCode();
            }
            if (HasStreamId)
            {
                hash ^= StreamId.GetHashCode();
            }
            if (HasType)
            {
                hash ^= Type.GetHashCode();
            }
            if (HasSource)
            {
                hash ^= Source.GetHashCode();
            }
            if (HasItem)
            {
                hash ^= Item.GetHashCode();
            }
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
Esempio n. 2
0
 public override int GetHashCode()
 {
     unchecked
     {
         return((StreamId.GetHashCode() * 397) ^ BlockKey.GetHashCode());
     }
 }
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = (CategoryId != null ? CategoryId.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (StreamId != null ? StreamId.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (CommentId != null ? CommentId.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Comment != null ? Comment.GetHashCode() : 0);
         return(hashCode);
     }
 }
Esempio n. 4
0
 public override int GetHashCode()
 {
     // https://stackoverflow.com/a/263416/1149773
     unchecked
     {
         int hash = 17;
         hash = hash * 23 + ClassId.GetHashCode();
         hash = hash * 23 + SectionId.GetHashCode();
         hash = hash * 23 + MediumId.GetHashCode();
         hash = hash * 23 + StreamId.GetHashCode();
         hash = hash * 23 + ShiftId.GetHashCode();
         return(hash);
     }
 }
Esempio n. 5
0
 public override int GetHashCode()
 {
     // Check the link below for details (Jon Skeet was here)
     unchecked
     {
         int hash = 17;
         hash = hash * 23 + ClassId.GetHashCode();
         hash = hash * 23 + SectionId.GetHashCode();
         hash = hash * 23 + MediumId.GetHashCode();
         hash = hash * 23 + StreamId.GetHashCode();
         hash = hash * 23 + ShiftId.GetHashCode();
         return(hash);
     }
 }
Esempio n. 6
0
 /// <summary>
 ///     Returns the hash code for this instance.
 /// </summary>
 /// <returns>The hash code for this instance.</returns>
 public override int GetHashCode()
 {
     return(StreamId.GetHashCode());
 }
        /// <summary>
        /// Create a subscriptionId that is unique per grainId, grainType, namespace combination.
        /// </summary>
        /// <param name="grainIdTypeCode"></param>
        /// <param name="streamId"></param>
        /// <returns></returns>
        private Guid MakeSubscriptionGuid(int grainIdTypeCode, StreamId streamId)
        {
            // next 2 shorts ing guid are from namespace hash
            int namespaceHash = streamId.Namespace.GetHashCode();
            byte[] namespaceHashByes = BitConverter.GetBytes(namespaceHash);
            short s1 = BitConverter.ToInt16(namespaceHashByes, 0);
            short s2 = BitConverter.ToInt16(namespaceHashByes, 2);

            // Tailing 8 bytes of the guid are from the hash of the streamId Guid and a hash of the full streamId.

            // get streamId guid hash code
            int streamIdGuidHash = streamId.Guid.GetHashCode();
            // get full streamId hash code
            int streamIdHash = streamId.GetHashCode();

            // build guid tailing 8 bytes from grainIdHash and the hash of the full streamId.
            var tail = new List<byte>();
            tail.AddRange(BitConverter.GetBytes(streamIdGuidHash));
            tail.AddRange(BitConverter.GetBytes(streamIdHash));

            // make guid.
            // - First int is grain type
            // - Two shorts from namespace hash
            // - 8 byte tail from streamId Guid and full stream hash.
            return SubscriptionMarker.MarkAsImplictSubscriptionId(new Guid(grainIdTypeCode, s1, s2, tail.ToArray()));
        }