Exemple #1
0
        /// <summary>
        ///     Moves a waggon at the specified index one step up.
        /// </summary>
        /// <param name="index">The index of the waggon.</param>
        public virtual void MoveWaggonUpAt(int index)
        {
            Contract.Requires <ArgumentOutOfRangeException>(index >= 0 && index < Waggons.Count());

            Contract.Assume(index < this._waggons.Count);

            Waggon waggon = this._waggons[index];

            this._waggons.RemoveAt(index);
            this._waggons.Insert(index - 1, waggon);
        }
        /// <summary>
        ///     Adds a <see cref="Waggon" /> to the end of the list of waggons.
        /// </summary>
        /// <param name="waggon">The <see cref="Waggon" /> to add.</param>
        /// <exception cref="ArgumentNullException">When <paramref name="waggon" /> is null.</exception>
        public virtual void AddNewWaggon(Waggon waggon)
        {
            Contract.Requires<ArgumentNullException>(waggon != null);

            this._waggons.Add(waggon);
        }
Exemple #3
0
        /// <summary>
        ///     Adds a <see cref="Waggon" /> to the end of the list of waggons.
        /// </summary>
        /// <param name="waggon">The <see cref="Waggon" /> to add.</param>
        /// <exception cref="ArgumentNullException">When <paramref name="waggon" /> is null.</exception>
        public virtual void AddNewWaggon(Waggon waggon)
        {
            Contract.Requires <ArgumentNullException>(waggon != null);

            this._waggons.Add(waggon);
        }