public virtual void Removelegs(legs __item) { if (__item != null && _legs != null && _legs.Contains(__item)) { _legs.Remove(__item); } }
public virtual void Addlegs(legs __item) { if (__item != null && _legs != null && !_legs.Contains(__item)) { _legs.Add(__item); } }
public virtual void SetlegsAt(legs __item, int __index) { if (__item == null) { _legs[__index] = null; } else { _legs[__index] = __item; } }
/// <summary> /// Returns true if self and the provided entity have the same Id values /// and the Ids are not of the default Id value /// </summary> protected bool HasSameNonDefaultIdAs(legs compareTo) { return(!this.IsTransient() && !compareTo.IsTransient() && this.legsKey.Equals(compareTo.legsKey)); }
/// <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 [legs] instance to use as the destination.</param> /// <returns>A copy of the object</returns> public virtual legs Copy(bool deep = false, Hashtable copiedObjects = null, bool asNew = false, bool reuseNestedObjects = false, legs copy = null) { if (copiedObjects == null) { copiedObjects = new Hashtable(); } if (copy == null && copiedObjects.Contains(this)) { return((legs)copiedObjects[this]); } copy = copy ?? new legs(); if (!asNew) { copy.TransientId = this.TransientId; copy.legsKey = this.legsKey; } copy.bogusNonTransitLeg = this.bogusNonTransitLeg; copy.distance = this.distance; copy.duration = this.duration; copy.endTime = this.endTime; copy.mode = this.mode; copy.route = this.route; copy.startTime = this.startTime; copy.agencyId = this.agencyId; copy.routeShortName = this.routeShortName; copy.routeLongName = this.routeLongName; copy.headsign = this.headsign; copy.routeColor = this.routeColor; copy.routeTextColor = this.routeTextColor; if (!copiedObjects.Contains(this)) { copiedObjects.Add(this, copy); } copy._steps = new List <steps>(); if (deep && this._steps != null) { foreach (var __item in this._steps) { if (!copiedObjects.Contains(__item)) { if (asNew && reuseNestedObjects) { copy.Addsteps(__item); } else { copy.Addsteps(__item.Copy(deep, copiedObjects, asNew)); } } else { copy.Addsteps((steps)copiedObjects[__item]); } } } if (deep && this._from != null) { if (!copiedObjects.Contains(this._from)) { if (asNew && reuseNestedObjects) { copy.from = this.from; } else if (asNew) { copy.from = this.from.Copy(deep, copiedObjects, true); } else { copy._from = this._from.Copy(deep, copiedObjects, false); } } else { if (asNew) { copy.from = (from)copiedObjects[this.from]; } else { copy._from = (from)copiedObjects[this.from]; } } } if (deep && this._legGeometry != null) { if (!copiedObjects.Contains(this._legGeometry)) { if (asNew && reuseNestedObjects) { copy.legGeometry = this.legGeometry; } else if (asNew) { copy.legGeometry = this.legGeometry.Copy(deep, copiedObjects, true); } else { copy._legGeometry = this._legGeometry.Copy(deep, copiedObjects, false); } } else { if (asNew) { copy.legGeometry = (legGeometry)copiedObjects[this.legGeometry]; } else { copy._legGeometry = (legGeometry)copiedObjects[this.legGeometry]; } } } if (deep && this._to != null) { if (!copiedObjects.Contains(this._to)) { if (asNew && reuseNestedObjects) { copy.to = this.to; } else if (asNew) { copy.to = this.to.Copy(deep, copiedObjects, true); } else { copy._to = this._to.Copy(deep, copiedObjects, false); } } else { if (asNew) { copy.to = (to)copiedObjects[this.to]; } else { copy._to = (to)copiedObjects[this.to]; } } } copy._intermediateStops = new List <intermediateStops>(); if (deep && this._intermediateStops != null) { foreach (var __item in this._intermediateStops) { if (!copiedObjects.Contains(__item)) { if (asNew && reuseNestedObjects) { copy.AddintermediateStops(__item); } else { copy.AddintermediateStops(__item.Copy(deep, copiedObjects, asNew)); } } else { copy.AddintermediateStops((intermediateStops)copiedObjects[__item]); } } } return(copy); }