/// <summary>
        /// Returns true if Activity instances are equal
        /// </summary>
        /// <param name="input">Instance of Activity to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(Activity input)
        {
            if (input == null)
            {
                return(false);
            }

            return
                ((
                     Type == input.Type ||
                     (Type != null &&
                      Type.Equals(input.Type))
                     ) &&
                 (
                     Id == input.Id ||
                     (Id != null &&
                      Id.Equals(input.Id))
                 ) &&
                 (
                     LocationId == input.LocationId ||
                     (LocationId != null &&
                      LocationId.Equals(input.LocationId))
                 ) &&
                 (
                     ArrTime == input.ArrTime ||
                     (ArrTime != null &&
                      ArrTime.Equals(input.ArrTime))
                 ) &&
                 (
                     EndTime == input.EndTime ||
                     (EndTime != null &&
                      EndTime.Equals(input.EndTime))
                 ) &&
                 (
                     WaitingTime == input.WaitingTime ||
                     (WaitingTime != null &&
                      WaitingTime.Equals(input.WaitingTime))
                 ) &&
                 (
                     Distance == input.Distance ||
                     (Distance != null &&
                      Distance.Equals(input.Distance))
                 ) &&
                 (
                     DrivingTime == input.DrivingTime ||
                     (DrivingTime != null &&
                      DrivingTime.Equals(input.DrivingTime))
                 ) &&
                 (
                     LoadBefore == input.LoadBefore ||
                     LoadBefore != null &&
                     LoadBefore.SequenceEqual(input.LoadBefore)
                 ) &&
                 (
                     LoadAfter == input.LoadAfter ||
                     LoadAfter != null &&
                     LoadAfter.SequenceEqual(input.LoadAfter)
                 ));
        }
Esempio n. 2
0
        public SortResults SortBefore(SortedTreeNode <IdType, DataType> other, bool testing)
        {
            if (LoadBefore == null)
            {
                if (!testing)
                {
                    LoadBefore   = other;
                    other.Parent = this;
                }

                return(SortResults.SortBefore);
            }

            return(LoadBefore.Sort(other));
        }
 /// <summary>
 /// Gets the hash code
 /// </summary>
 /// <returns>Hash code</returns>
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         int hashCode = 41;
         if (Type != null)
         {
             hashCode = hashCode * 59 + Type.GetHashCode();
         }
         if (Id != null)
         {
             hashCode = hashCode * 59 + Id.GetHashCode();
         }
         if (LocationId != null)
         {
             hashCode = hashCode * 59 + LocationId.GetHashCode();
         }
         if (ArrTime != null)
         {
             hashCode = hashCode * 59 + ArrTime.GetHashCode();
         }
         if (EndTime != null)
         {
             hashCode = hashCode * 59 + EndTime.GetHashCode();
         }
         if (WaitingTime != null)
         {
             hashCode = hashCode * 59 + WaitingTime.GetHashCode();
         }
         if (Distance != null)
         {
             hashCode = hashCode * 59 + Distance.GetHashCode();
         }
         if (DrivingTime != null)
         {
             hashCode = hashCode * 59 + DrivingTime.GetHashCode();
         }
         if (LoadBefore != null)
         {
             hashCode = hashCode * 59 + LoadBefore.GetHashCode();
         }
         if (LoadAfter != null)
         {
             hashCode = hashCode * 59 + LoadAfter.GetHashCode();
         }
         return(hashCode);
     }
 }