Example #1
0
 public virtual void RemoveUrbanSegments(UrbanSegment __item)
 {
     if (__item != null && urbanSegments != null && urbanSegments.Contains(__item))
     {
         urbanSegments.Remove(__item);
     }
 }
Example #2
0
 public virtual void AddUrbanSegments(UrbanSegment __item)
 {
     if (__item != null && urbanSegments != null && !urbanSegments.Contains(__item))
     {
         urbanSegments.Add(__item);
     }
 }
Example #3
0
 public virtual void SetUrbanSegmentsAt(UrbanSegment __item, int __index)
 {
     if (__item == null)
     {
         urbanSegments[__index] = null;
     }
     else
     {
         urbanSegments[__index] = __item;
     }
 }
/// <summary>
/// Copies the current object to a new instance
/// </summary>
/// <param name="deep">Copy members that refer to objects external to this class (not dependent)</param>
/// <param name="copiedObjects">Objects that should be reused</param>
/// <param name="asNew">Copy the current object as a new one, ready to be persisted, along all its members.</param>
/// <param name="reuseNestedObjects">If asNew is true, this flag if set, forces the reuse of all external objects.</param>
/// <param name="copy">Optional - An existing [UrbanSegment] instance to use as the destination.</param>
/// <returns>A copy of the object</returns>
        public virtual UrbanSegment Copy(bool deep = false, Hashtable copiedObjects = null, bool asNew = false, bool reuseNestedObjects = false, UrbanSegment copy = null)
        {
            if (copiedObjects == null)
            {
                copiedObjects = new Hashtable();
            }
            if (copy == null && copiedObjects.Contains(this))
            {
                return((UrbanSegment)copiedObjects[this]);
            }
            copy = copy ?? new UrbanSegment();
            if (!asNew)
            {
                copy.TransientId = this.TransientId;
            }
            if (!copiedObjects.Contains(this))
            {
                copiedObjects.Add(this, copy);
            }
            if (deep && this.origin != null)
            {
                if (!copiedObjects.Contains(this.origin))
                {
                    if (asNew && reuseNestedObjects)
                    {
                        copy.Origin = this.Origin;
                    }
                    else if (asNew)
                    {
                        copy.Origin = this.Origin.Copy(deep, copiedObjects, true);
                    }
                    else
                    {
                        copy.origin = this.origin.Copy(deep, copiedObjects, false);
                    }
                }
                else
                {
                    if (asNew)
                    {
                        copy.Origin = (Station)copiedObjects[this.Origin];
                    }
                    else
                    {
                        copy.origin = (Station)copiedObjects[this.Origin];
                    }
                }
            }
            if (deep && this.destination != null)
            {
                if (!copiedObjects.Contains(this.destination))
                {
                    if (asNew && reuseNestedObjects)
                    {
                        copy.Destination = this.Destination;
                    }
                    else if (asNew)
                    {
                        copy.Destination = this.Destination.Copy(deep, copiedObjects, true);
                    }
                    else
                    {
                        copy.destination = this.destination.Copy(deep, copiedObjects, false);
                    }
                }
                else
                {
                    if (asNew)
                    {
                        copy.Destination = (Station)copiedObjects[this.Destination];
                    }
                    else
                    {
                        copy.destination = (Station)copiedObjects[this.Destination];
                    }
                }
            }
            if (deep && this.urbanTrip != null)
            {
                if (!copiedObjects.Contains(this.urbanTrip))
                {
                    if (asNew && reuseNestedObjects)
                    {
                        copy.UrbanTrip = this.UrbanTrip;
                    }
                    else if (asNew)
                    {
                        copy.UrbanTrip = this.UrbanTrip.Copy(deep, copiedObjects, true);
                    }
                    else
                    {
                        copy.urbanTrip = this.urbanTrip.Copy(deep, copiedObjects, false);
                    }
                }
                else
                {
                    if (asNew)
                    {
                        copy.UrbanTrip = (UrbanTrip)copiedObjects[this.UrbanTrip];
                    }
                    else
                    {
                        copy.urbanTrip = (UrbanTrip)copiedObjects[this.UrbanTrip];
                    }
                }
            }
            base.Copy(deep, copiedObjects, asNew, reuseNestedObjects, copy);
            return(copy);
        }