Exemplo n.º 1
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 (Id != null)
                {
                    hashCode = hashCode * 59 + Id.GetHashCode();
                }

                hashCode = hashCode * 59 + Type.GetHashCode();

                hashCode = hashCode * 59 + Mode.GetHashCode();
                if (Directions != null)
                {
                    hashCode = hashCode * 59 + Directions.GetHashCode();
                }

                hashCode = hashCode * 59 + Distance.GetHashCode();

                hashCode = hashCode * 59 + TravelTime.GetHashCode();
                if (Coords != null)
                {
                    hashCode = hashCode * 59 + Coords.GetHashCode();
                }
                if (Direction != null)
                {
                    hashCode = hashCode * 59 + Direction.GetHashCode();
                }
                if (Road != null)
                {
                    hashCode = hashCode * 59 + Road.GetHashCode();
                }
                if (Turn != null)
                {
                    hashCode = hashCode * 59 + Turn.GetHashCode();
                }
                if (Line != null)
                {
                    hashCode = hashCode * 59 + Line.GetHashCode();
                }
                if (DepartureStation != null)
                {
                    hashCode = hashCode * 59 + DepartureStation.GetHashCode();
                }
                if (ArrivalStation != null)
                {
                    hashCode = hashCode * 59 + ArrivalStation.GetHashCode();
                }
                if (DepartsAt != null)
                {
                    hashCode = hashCode * 59 + DepartsAt.GetHashCode();
                }
                if (ArrivesAt != null)
                {
                    hashCode = hashCode * 59 + ArrivesAt.GetHashCode();
                }

                hashCode = hashCode * 59 + NumStops.GetHashCode();
                return(hashCode);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Returns true if ResponseRoutePart instances are equal
        /// </summary>
        /// <param name="other">Instance of ResponseRoutePart to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(ResponseRoutePart other)
        {
            if (other is null)
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     Id == other.Id ||
                     Id != null &&
                     Id.Equals(other.Id)
                     ) &&
                 (
                     Type == other.Type ||

                     Type.Equals(other.Type)
                 ) &&
                 (
                     Mode == other.Mode ||

                     Mode.Equals(other.Mode)
                 ) &&
                 (
                     Directions == other.Directions ||
                     Directions != null &&
                     Directions.Equals(other.Directions)
                 ) &&
                 (
                     Distance == other.Distance ||

                     Distance.Equals(other.Distance)
                 ) &&
                 (
                     TravelTime == other.TravelTime ||

                     TravelTime.Equals(other.TravelTime)
                 ) &&
                 (
                     Coords == other.Coords ||
                     Coords != null &&
                     other.Coords != null &&
                     Coords.SequenceEqual(other.Coords)
                 ) &&
                 (
                     Direction == other.Direction ||
                     Direction != null &&
                     Direction.Equals(other.Direction)
                 ) &&
                 (
                     Road == other.Road ||
                     Road != null &&
                     Road.Equals(other.Road)
                 ) &&
                 (
                     Turn == other.Turn ||
                     Turn != null &&
                     Turn.Equals(other.Turn)
                 ) &&
                 (
                     Line == other.Line ||
                     Line != null &&
                     Line.Equals(other.Line)
                 ) &&
                 (
                     DepartureStation == other.DepartureStation ||
                     DepartureStation != null &&
                     DepartureStation.Equals(other.DepartureStation)
                 ) &&
                 (
                     ArrivalStation == other.ArrivalStation ||
                     ArrivalStation != null &&
                     ArrivalStation.Equals(other.ArrivalStation)
                 ) &&
                 (
                     DepartsAt == other.DepartsAt ||
                     DepartsAt != null &&
                     DepartsAt.Equals(other.DepartsAt)
                 ) &&
                 (
                     ArrivesAt == other.ArrivesAt ||
                     ArrivesAt != null &&
                     ArrivesAt.Equals(other.ArrivesAt)
                 ) &&
                 (
                     NumStops == other.NumStops ||

                     NumStops.Equals(other.NumStops)
                 ));
        }