Ejemplo n.º 1
0
        public override int GetHashCode()
        {
            unchecked
            {
                var hashCode = BridgeUid != null?BridgeUid.GetHashCode() : 0;

                hashCode = (hashCode * 397) ^ (Flag != null ? Flag.GetHashCode() : 0);
                hashCode = (hashCode * 397) ^ (Label != null ? Label.GetHashCode() : 0);
                hashCode = (hashCode * 397) ^ (Properties != null ? Properties.GetHashCode() : 0);
                hashCode = (hashCode * 397) ^
                           (RepresentationProperty != null ? RepresentationProperty.GetHashCode() : 0);
                hashCode = (hashCode * 397) ^ (ThingUid != null ? ThingUid.GetHashCode() : 0);
                hashCode = (hashCode * 397) ^ (ThingTypeUid != null ? ThingTypeUid.GetHashCode() : 0);
                return(hashCode);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Returns true if DiscoveryResultDTO instances are equal
        /// </summary>
        /// <param name="input">Instance of DiscoveryResultDTO to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(DiscoveryResultDTO input)
        {
            if (input == null)
            {
                return(false);
            }

            return
                ((
                     BridgeUID == input.BridgeUID ||
                     (BridgeUID != null &&
                      BridgeUID.Equals(input.BridgeUID))
                     ) &&
                 (
                     Flag == input.Flag ||
                     (Flag != null &&
                      Flag.Equals(input.Flag))
                 ) &&
                 (
                     Label == input.Label ||
                     (Label != null &&
                      Label.Equals(input.Label))
                 ) &&
                 (
                     Properties == input.Properties ||
                     Properties != null &&
                     Properties.SequenceEqual(input.Properties)
                 ) &&
                 (
                     RepresentationProperty == input.RepresentationProperty ||
                     (RepresentationProperty != null &&
                      RepresentationProperty.Equals(input.RepresentationProperty))
                 ) &&
                 (
                     ThingUID == input.ThingUID ||
                     (ThingUID != null &&
                      ThingUID.Equals(input.ThingUID))
                 ) &&
                 (
                     ThingTypeUID == input.ThingTypeUID ||
                     (ThingTypeUID != null &&
                      ThingTypeUID.Equals(input.ThingTypeUID))
                 ));
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Gets the hash code
 /// </summary>
 /// <returns>Hash code</returns>
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         int hashCode = 41;
         if (BridgeUID != null)
         {
             hashCode = hashCode * 59 + BridgeUID.GetHashCode();
         }
         if (Flag != null)
         {
             hashCode = hashCode * 59 + Flag.GetHashCode();
         }
         if (Label != null)
         {
             hashCode = hashCode * 59 + Label.GetHashCode();
         }
         if (Properties != null)
         {
             hashCode = hashCode * 59 + Properties.GetHashCode();
         }
         if (RepresentationProperty != null)
         {
             hashCode = hashCode * 59 + RepresentationProperty.GetHashCode();
         }
         if (ThingUID != null)
         {
             hashCode = hashCode * 59 + ThingUID.GetHashCode();
         }
         if (ThingTypeUID != null)
         {
             hashCode = hashCode * 59 + ThingTypeUID.GetHashCode();
         }
         return(hashCode);
     }
 }