Esempio n. 1
0
        /// <summary>
        /// Checks whether the given county is a valid model, and then proceeds to look through any connected models
        /// that are not in the checkedModels set and ensure that they all result in a valid model.
        /// </summary>
        /// <param name="county">The model to check.</param>
        /// <param name="checkedModels">A set of models that have already been checked.</param>
        private static void ValidateCounty(County county, HashSet <int> checkedModels)
        {
            if (county == null)
            {
                throw new ArgumentException("County cannot be null.");
            }

            if (county.Name == null)
            {
                throw new ArgumentException("County.Name cannot be null.");
            }
            if (county.Name.Length < 2)
            {
                throw new ArgumentException("County.Name cannot be shorter than 3 characters.");
            }
            if (county.Seats == -1)
            {
                throw new ArgumentException("County.Seats cannot be the default value.");
            }

            checkedModels.Add(county.GetHashCode());

            if (county.Results != null)
            {
                foreach (Result result in county.Results)
                {
                    if (!checkedModels.Contains(result.GetHashCode()))
                    {
                        ValidateResult(result, checkedModels);
                    }
                }
            }
        }
        public virtual int _GetUniqueIdentifier()
        {
            var hashCode = 399326290;

            hashCode = hashCode * -1521134295 + (Id?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (Area?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (PostalCode?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (County?.GetHashCode() ?? 0);
            return(hashCode);
        }
Esempio n. 3
0
 public override int GetHashCode()
 {
     unchecked
     {
         int hashCode = base.GetHashCode();
         hashCode = (hashCode * 397) ^ (StreetAddress2 != null ? StreetAddress2.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (County != null ? County.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Country != null ? Country.GetHashCode() : 0);
         return(hashCode);
     }
 }
 protected override int GetHashCodeCore()
 {
     return(CountryCode.GetHashCode() ^
            Country.GetHashCode() ^
            PostalCode.GetHashCode() ^
            State.GetHashCode() ^
            County.GetHashCode() ^
            City.GetHashCode() ^
            Suburb.GetHashCode() ^
            StreetName.GetHashCode() ^
            StreetNumber.GetHashCode() ^
            PlaceName.GetHashCode());
 }
        public override int GetHashCode()
        {
            unchecked
            {
                var hashCode = Country != null?Country.GetHashCode() : 0;

                hashCode = (hashCode * 397) ^ (Voivodeship != null ? Voivodeship.GetHashCode() : 0);
                hashCode = (hashCode * 397) ^ (County != null ? County.GetHashCode() : 0);
                hashCode = (hashCode * 397) ^ (Community != null ? Community.GetHashCode() : 0);
                hashCode = (hashCode * 397) ^ (City != null ? City.GetHashCode() : 0);
                hashCode = (hashCode * 397) ^ (District != null ? District.GetHashCode() : 0);
                hashCode = (hashCode * 397) ^ (Street != null ? Street.GetHashCode() : 0);
                hashCode = (hashCode * 397) ^ (Number != null ? Number.GetHashCode() : 0);
                return(hashCode);
            }
        }
Esempio n. 6
0
 public override int GetHashCode()
 {
     unchecked
     {
         var result = NamedTupleCommon.DefaultHashCode;
         result = (result << 5) + result ^ (Id.GetHashCode());
         result = (result << 5) + result ^ (CareOf != null ? CareOf.GetHashCode() : NamedTupleCommon.DefaultHashCode);
         result = (result << 5) + result ^ (Address1 != null ? Address1.GetHashCode() : NamedTupleCommon.DefaultHashCode);
         result = (result << 5) + result ^ (Address2 != null ? Address2.GetHashCode() : NamedTupleCommon.DefaultHashCode);
         result = (result << 5) + result ^ (Address3 != null ? Address3.GetHashCode() : NamedTupleCommon.DefaultHashCode);
         result = (result << 5) + result ^ (Address4 != null ? Address4.GetHashCode() : NamedTupleCommon.DefaultHashCode);
         result = (result << 5) + result ^ (City != null ? City.GetHashCode() : NamedTupleCommon.DefaultHashCode);
         result = (result << 5) + result ^ (Zip != null ? Zip.GetHashCode() : NamedTupleCommon.DefaultHashCode);
         result = (result << 5) + result ^ (County != null ? County.GetHashCode() : NamedTupleCommon.DefaultHashCode);
         result = (result << 5) + result ^ (Country != null ? Country.GetHashCode() : NamedTupleCommon.DefaultHashCode);
         return(result);
     }
 }
Esempio n. 7
0
        public override int GetHashCode()
        {
            unchecked
            {
                var hashCode = Company != null?Company.GetHashCode() : 0;

                hashCode = (hashCode * 397) ^ (Address1 != null ? Address1.GetHashCode() : 0);
                hashCode = (hashCode * 397) ^ (Address2 != null ? Address2.GetHashCode() : 0);
                hashCode = (hashCode * 397) ^ (Address3 != null ? Address3.GetHashCode() : 0);
                hashCode = (hashCode * 397) ^ (Address4 != null ? Address4.GetHashCode() : 0);
                hashCode = (hashCode * 397) ^ (Address5 != null ? Address5.GetHashCode() : 0);
                hashCode = (hashCode * 397) ^ (Town != null ? Town.GetHashCode() : 0);
                hashCode = (hashCode * 397) ^ (County != null ? County.GetHashCode() : 0);
                hashCode = (hashCode * 397) ^ (Postcode != null ? Postcode.GetHashCode() : 0);
                hashCode = (hashCode * 397) ^ (Country != null ? Country.GetHashCode() : 0);
                return(hashCode);
            }
        }
Esempio n. 8
0
        /// <summary>
        /// Gets the hash code
        /// </summary>
        /// <returns>Hash code</returns>
        public override int GetHashCode()
        {
            unchecked // Overflow is fine, just wrap
            {
                var hashCode = 41;
                // Suitable nullity checks etc, of course :)
                if (Name != null)
                {
                    hashCode = hashCode * 59 + Name.GetHashCode();
                }
                if (Label != null)
                {
                    hashCode = hashCode * 59 + Label.GetHashCode();
                }

                hashCode = hashCode * 59 + Score.GetHashCode();
                if (HouseNumber != null)
                {
                    hashCode = hashCode * 59 + HouseNumber.GetHashCode();
                }
                if (Street != null)
                {
                    hashCode = hashCode * 59 + Street.GetHashCode();
                }
                if (Region != null)
                {
                    hashCode = hashCode * 59 + Region.GetHashCode();
                }
                if (RegionCode != null)
                {
                    hashCode = hashCode * 59 + RegionCode.GetHashCode();
                }
                if (Neighbourhood != null)
                {
                    hashCode = hashCode * 59 + Neighbourhood.GetHashCode();
                }
                if (County != null)
                {
                    hashCode = hashCode * 59 + County.GetHashCode();
                }
                if (Macroregion != null)
                {
                    hashCode = hashCode * 59 + Macroregion.GetHashCode();
                }
                if (City != null)
                {
                    hashCode = hashCode * 59 + City.GetHashCode();
                }
                if (Country != null)
                {
                    hashCode = hashCode * 59 + Country.GetHashCode();
                }
                if (CountryCode != null)
                {
                    hashCode = hashCode * 59 + CountryCode.GetHashCode();
                }
                if (Continent != null)
                {
                    hashCode = hashCode * 59 + Continent.GetHashCode();
                }
                if (Postcode != null)
                {
                    hashCode = hashCode * 59 + Postcode.GetHashCode();
                }
                if (Features != null)
                {
                    hashCode = hashCode * 59 + Features.GetHashCode();
                }
                return(hashCode);
            }
        }
Esempio n. 9
0
 public override int GetHashCode() =>
 StateCode.GetHashCode() ^
 Congress.GetHashCode() ^
 StateSenate.GetHashCode() ^
 StateHouse.GetHashCode() ^
 County.GetHashCode();